12 solutions
Information
- ID
- 5479
- Time
- 1000ms
- Memory
- 125MiB
- Difficulty
- 1
- Tags
- # Submissions
- 1566
- Accepted
- 1013
- Uploaded By
给你 a 元 b 角,每个东西 1 元 9 角,一共能买几个。
首先全部转为角这个单位,即你一共有a*10+b角,一个东西 19 角。因为 C++ 整数除法采用减一法(即舍去小数),因此直接相除得出结果。
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
cout<<(10*a+b)/19;
}
By signing up a HydroOJ universal account, you can submit code and join discussions in all online judging services provided by us.