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 ...
随机推荐
- PHP - pcntl_fork() 执行过程详解
<?php $pid = pcntl_fork();if ($pid == -1){ die("could not fork");}elseif($pid == 0 ...
- javascript中的二维数组
要创建一个二位数组我们脑子里第一个出现的就是 var arr=[][]; 但是在javascript这样是会报错的,要在javascrip中创建一个二位数组对象方法如下 方法一 直接把数组写出 ...
- docker 入門
http://dockone.io/article/277 我的碎碎念:Docker入门指南 [编者的话]之前曾经翻译过很多Docker入门介绍的文章,之所以再翻译这篇,是因为Anders的角度很独特 ...
- springboot 面向切面
@Aspect @Configuration public class AspectTest { @Pointcut("execution(public String xxx.xxx.xxx ...
- 1.Two Sum (Array; HashTable)
Given an array of integers, find two numbers such that they add up to a specific target number. The ...
- TZOJ 4007 The Siruseri Sports Stadium(区间贪心)
描述 The bustling town of Siruseri has just one sports stadium. There are a number of schools, college ...
- Mask_RCNN Test
- 搜索旋转排序数组 II
跟进“搜索旋转排序数组”,假如有重复元素又将如何? 一句话思路:不能二分,因为复杂度是n eg全是0,找一个1 class Solution { public boolean search(int[] ...
- HTML实例
HTML内容繁多,不易记忆,故将此网址 作为查阅复习的工具http://www.w3school.com.cn/example/html_examples.asp
- discuz回贴通知插件实现-获取邮件内容
//自定义钩子函数,命名:模块_函数名_output()或模块_函数名() //一个是模块执行完,模板输出前执行.一个是模块执行前 //post_reply_output函数会在所有post操作中都会 ...