题意:你手中有10元的钱,还有一个r元的零钱,要买一个价格为k的物品,但是你要求不找零钱,求最少要买多少物品。

析:直接暴力,最多买10个物品就够了1-10.

代码如下:

  1. #pragma comment(linker, "/STACK:1024000000,1024000000")
  2. #include <cstdio>
  3. #include <string>
  4. #include <cstdlib>
  5. #include <cmath>
  6. #include <iostream>
  7. #include <cstring>
  8. #include <set>
  9. #include <queue>
  10. #include <algorithm>
  11. #include <vector>
  12. #include <map>
  13. #include <cctype>
  14. #include <cmath>
  15. #include <stack>
  16. #define freopenr freopen("in.txt", "r", stdin)
  17. #define freopenw freopen("out.txt", "w", stdout)
  18. using namespace std;
  19.  
  20. typedef long long LL;
  21. typedef pair<int, int> P;
  22. const int INF = 0x3f3f3f3f;
  23. const double inf = 0x3f3f3f3f3f3f;
  24. const double PI = acos(-1.0);
  25. const double eps = 1e-8;
  26. const int maxn = 1e5 + 5;
  27. const int mod = 1e9 + 7;
  28. const int dr[] = {-1, 1, 0, 0};
  29. const int dc[] = {0, 0, 1, -1};
  30. const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
  31. int n, m;
  32. const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  33. const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  34. inline int Min(int a, int b){ return a < b ? a : b; }
  35. inline int Max(int a, int b){ return a > b ? a : b; }
  36. inline LL Min(LL a, LL b){ return a < b ? a : b; }
  37. inline LL Max(LL a, LL b){ return a > b ? a : b; }
  38. inline bool is_in(int r, int c){
  39. return r >= 0 && r < n && c >= 0 && c < m;
  40. }
  41.  
  42. int main(){
  43. while(cin >> n >> m){
  44. for(int i = 1; i <= 10; ++i){
  45. if(n * i % 10 == 0 || n * i % 10 == m){
  46. cout << i << endl;
  47. break;
  48. }
  49. }
  50. }
  51. return 0;
  52. }

CodeForces 732A Buy a Shovel (水题)的更多相关文章

  1. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树

    A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...

  3. codeforces 696A Lorenzo Von Matterhorn 水题

    这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...

  4. CodeForces 589I Lottery (暴力,水题)

    题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...

  5. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  6. codeforces 710A A. King Moves(水题)

    题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...

  7. codeforces 659A A. Round House(水题)

    题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. CodeForces 489B BerSU Ball (水题 双指针)

    B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  9. codeforces 702A A. Maximum Increase(水题)

    题目链接: A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input sta ...

随机推荐

  1. UVa 11609 (计数 公式推导) Teams

    n个人里选k个人有C(n, k)中方法,再从里面选一人当队长,有k中方法. 所以答案就是 第一步的变形只要按照组合数公式展开把n提出来即可. #include <cstdio> typed ...

  2. LA 3266 (贪心) Tian Ji -- The Horse Racing

    题意: 田忌和齐王各有n匹马,如果马的速度比齐王的快就赢200,慢则输200,相等不赔不赚. 已知两人每匹马的速度(为整数)和齐王所排出的马的顺序,问田忌该如何应对才能使收益最大. 分析: 本以为是一 ...

  3. max-height,min-height在IE下不支持的解决方法

    max-height,min-height在IE下不支持的解决方法 max-width:160px; max-height:160px; _width:expression(this.width &g ...

  4. memcached 最大连接数及其内存大小的设置

    memcached的基本设置: -p 监听的端口-l 连接的IP地址, 默认是本机-d start 启动memcached服务-d restart 重起memcached服务-d stop|shutd ...

  5. 一天一个Java基础——序列化

    1.概念 Java的“对象序列化”能将一个实现了Serializable接口的对象转换成一组byte,这样日后要用这个对象的时候,能把这些byte数据恢复出来,并据此重新构建那个对象. 对象序列化能实 ...

  6. 常用UI布局

    1.LinearLayout(线性布局):将布局所包含的控件在线性方向上依次排列. <1>android:orientation 指定了排列方向(垂直方向(vertical).水平方向(h ...

  7. 字符串截取数字和点击radio显示不同内容

    <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> & ...

  8. 【转】STL空间配置器

    STL空间配置器(allocator)在所有容器内部默默工作,负责空间的配置和回收.STL标准为空间配置器定义了标准接口(可见<STL源码剖析>P43).而具体实现细节则由各编译器实现版本 ...

  9. redis 和 bloom filter

    今天打算使用redis 的bitset搞一个 bloom filter, 这样的好处是可以节省内存,坏处是可能在会有一些数据因为提示重复而无法保存. bloom filter 的大体原理就是通过不同的 ...

  10. matlab 学习

    http://blog.sina.com.cn/s/blog_7086379501012pc5.html <a href = "http://blog.sina.com.cn/s/bl ...