codeforces732A A. Buy a Shovel

来源:互联网 发布:戴尔公司待遇 知乎 编辑:程序博客网 时间:2024/05/29 11:45
这道题题的大意就是你身上有一个额外的1-9的零钱和无数个10块,然后给出一个物品的价格,问买它的最少数量,其实最多超不过10,如果超多10一定是10的整数倍就一定可以,然后题中说可以用那个额外的钱也可以不用, not using the coin of r burles),具体代码如下:
#include<iostream>#include<cstdio>using namespace std;int main(){int k;int r;int j=0;int p = 0;cin >> k >> r;for (int i = 1; i < 10; i++){if (((i*k) % 10 )== 0){j= i;break;}else if (((i*k) - r) % 10 == 0){j = i;break;}}cout << j << endl;return 0;} 


1 0