http://acm.hdu.edu.cn/showproblem.php?pid=4993

满足ax + by = c的x,y对数

水题,暴力

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cmath>
  4. #include <cstring>
  5. #include <string>
  6. #include <queue>
  7. #include <map>
  8. #include <iostream>
  9. #include <algorithm>
  10. using namespace std;
  11. #define RD(x) scanf("%d",&x)
  12. #define RD2(x,y) scanf("%d%d",&x,&y)
  13. #define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
  14. #define clr0(x) memset(x,0,sizeof(x))
  15. typedef long long LL;
  16. int a,b,c;
  17.  
  18. int main() {
  19. int _;RD(_);while(_--){
  20. RD3(a,b,c);
  21. if(a > b)
  22. swap(a,b);
  23. int ans = 0;
  24. for(int i = 1;;++i){
  25. int x = c - a * i;
  26. if(x <= 0)
  27. break;
  28. if(x%b == 0)
  29. ans++;
  30. }
  31. printf("%d\n", ans);
  32. }
  33. return 0;
  34. }

hdu 4993的更多相关文章

  1. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  2. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  3. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  4. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  5. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  6. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  7. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

  8. HDU 3791二叉搜索树解题(解题报告)

    1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...

  9. hdu 4329

    problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟  a.     p(r)=   R'/i   rel(r)=(1||0)  R ...

随机推荐

  1. pyplot绘图区域

    pyplot绘图区域 Matplotlib图像组成 matplotlib中,整个图像为一个Figure对象,与用户交互的整个窗口 Figure对象中包含一个或多个Axes(ax)子对象,每个ax子对象 ...

  2. springboot不能加载*.properties

    代码检查了无数遍!这是在intellij IDEA 下!!! 如图,这些配置文件直接放在sms-server下面,并没有放在sms-server/src/main/resources下面,所以不是cl ...

  3. SciTE: 中文字符支持问题

    SciTE: 中文字符支持问题   SciTE(Scintilla Text Editor)是一个体积小巧的文本编辑器. 但是它默认的设置对中文字符处理不好,其实只要对它进行相应的配置,就可以了. 1 ...

  4. hdoj1160 DP--LIS

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 思路: 又是一道LIS的应用题,先预处理,按照w从小到大排列,那么原问题就转变成求该排列的LIS ...

  5. Ubuntu 16.04中VirtualBox 5.1使用U盘/USB设备的方法

    环境: Ubuntu 16.04 LTS VirtualBox 5.1.26 r118224 虚拟机系统:Windows 7 SP1 64 安装扩展: 在这里下载:(自己注意版本好,版本不匹配安装不成 ...

  6. clamp 函数

    返回范围内的一个数值.可以使用 clamp 函数将不断增加.减小或随机变化的数值限制在一系列的值中. float clamp(float minnumber, float maxnumber, flo ...

  7. 最近公共祖先 · Lowest Common Ancestor

    [抄题]: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. “Th ...

  8. SpringMVC工作原理1(基础机制)

    图1.基本原理图 Spring工作流程描述       1. 用户向服务器发送请求,请求被Spring 前端控制Servelt DispatcherServlet捕获:       2. Dispat ...

  9. linux下iptables防火墙设置

    各位linux的爱好者或者工作跟linux相关的程序员,我们在工作中经常遇到应用服务器端口已经启动, 在网络正常的情况下,访问不到应用程序,这个跟防火墙设置有关 操作步骤 1.检查有没有启动防火墙 s ...

  10. Laravel 日期时间处理包 Carbon 的应用

    在编写 PHP 应用时经常需要处理日期和时间,这篇文章带你了解一下 Carbon – 继承自 PHP DateTime 类的 API 扩展,它使得处理日期和时间更加简单.Laravel 中默认使用的时 ...