hdu 4993
http://acm.hdu.edu.cn/showproblem.php?pid=4993
满足ax + by = c的x,y对数
水题,暴力
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define clr0(x) memset(x,0,sizeof(x))
typedef long long LL;
int a,b,c; int main() {
int _;RD(_);while(_--){
RD3(a,b,c);
if(a > b)
swap(a,b);
int ans = 0;
for(int i = 1;;++i){
int x = c - a * i;
if(x <= 0)
break;
if(x%b == 0)
ans++;
}
printf("%d\n", ans);
}
return 0;
}
hdu 4993的更多相关文章
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
随机推荐
- threading实例
import paramiko, threading import queue import pymysql class ThreadPool(object): def __init__(self, ...
- spark UDF函数
Spark(Hive) SQL中UDF的使用(Python):http://www.tuicool.com/articles/3yMBNb7
- 元素的定位tag_name,link_text,class_name
tag_name 就是根据HTML的标签的名称来定位的: 案例:打开我要自学网,会有用户名和密码的输入框 例如:拿51zxw.net为例 from time import sleep #加载浏览器驱动 ...
- httpclient4例子
参考:http://hc.apache.org/httpclient-3.x/tutorial.html import org.apache.http.HttpEntity; import org.a ...
- clear(), evict(), flush()三种方法的用法实例
先贴代码: @Before public void init() { System.out.println("Test开始之前执行"); Configuration configu ...
- 几个小模板:topology, dijkstra, spfa, floyd, kruskal, prim
1.topology: #include <fstream> #include <iostream> #include <algorithm> #include & ...
- pyhon之函数参数
#函数的参数分为形参和实参,其中形参就是形式参数,是在创建函数的时候定义,实参就是实际参数,是在调用的函数的时候创建,这个并不是重点,具体#的参数内部,我们可以把参数分为以下4种# 1.普通参数# 2 ...
- php自定义session存储路径
1.找到php.ini配置文件,找到session.save_path,修改如下: 其中2表示session存储的目录深度,也就是分目录,避免一个目录下文件太多,造成IO负担. session.sav ...
- mvc 封装控件使用mvcpager
具体使用如下: 前台部分: @RenderPage("~/Views/Controls/_Pagebar.cshtml", new PageBar { pageIndex = Mo ...
- 全基因组测序 从头测序(de novo sequencing) 重测序(re-sequencing)
全基因组测序 全基因组测序分为从头测序(de novo sequencing)和重测序(re-sequencing). 从头测序(de novo)不需要任何参考基因组信息即可对某个物种的基因组进行测序 ...