HDU 1562 Guess the number
来源:互联网 发布:怎样联系网络推手 编辑:程序博客网 时间:2024/05/29 07:25
Description
Happy new year to everybody!
Now, I want you to guess a minimum number x betwwn 1000 and 9999 to let
(1) x % a = 0;
(2) (x+1) % b = 0;
(3) (x+2) % c = 0;
and a, b, c are integers between 1 and 100.
Given a,b,c, tell me what is the number of x ?
Now, I want you to guess a minimum number x betwwn 1000 and 9999 to let
(1) x % a = 0;
(2) (x+1) % b = 0;
(3) (x+2) % c = 0;
and a, b, c are integers between 1 and 100.
Given a,b,c, tell me what is the number of x ?
Input
The number of test cases c is in the first line of input, then c test cases followed.every test contains three integers a, b, c.
Output
For each test case your program should output one line with the minimal number x, you should remember that x is between 1000 and 9999. If there is no answer for x, output "Impossible".
Sample Input
244 38 4925 56 3
Sample Output
Impossible2575
大水题,什么都不用管,直接循环跑一遍就好了
#include<set>#include<map>#include<ctime>#include<cmath>#include<stack>#include<queue>#include<bitset>#include<cstdio>#include<string>#include<cstring>#include<iostream>#include<algorithm>#include<functional>#define rep(i,j,k) for (int i = j; i <= k; i++)#define per(i,j,k) for (int i = j; i >= k; i--)using namespace std;typedef long long LL;const int low(int x) { return x&-x; }const double eps = 1e-8;const int INF = 0x7FFFFFFF;const int mod = 1e9 + 7;const int N = 1e5 + 10;int T, n, m, a, b, c;bool solve(){rep(x, 1000, 9999){if (x%a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0){printf("%d\n", x);return true;}}return false;}int main(){scanf("%d", &T);while (T--){scanf("%d%d%d", &a, &b, &c);if (!solve()) printf("Impossible\n");}return 0;}
0 0
- hdu 1562 Guess the number
- hdu 1562 Guess the number
- HDU 1562 Guess the number
- HDU 1562 Guess the number
- HDU 1562 Guess the number
- hdu-oj 1562 Guess the number
- 1562 Guess the number
- hdu.1562.Guess the number
- HDU 5981 Guess the number
- 杭电 HDU ACM 1562 Guess the number
- HDOJ(HDU) 1562 Guess the number(水题,枚举就行)
- hdoj-1562-Guess the number
- HDOJ 1562 Guess the number
- hdu 5981:Guess the number 动态规划
- HDU-5981-Guess the number-规律
- HDU-5981 Guess the number(DP)
- hdoj.1562 Guess the number 20140825
- Guess the Number
- 官方API指南之处理运行时变更
- 短信猫开发(1):常用指令
- 关于Python可变参数的理解
- java -version的输出内容分析
- PyGobject(一百零七)CSS系列——动画背景
- HDU 1562 Guess the number
- chromium修改Tab 页
- RICOH THETA×IoT Developers Contest
- iOS runloop理解
- Cornerstone无法上传 .so 文件的问题
- POJ-1300 Door Man
- AndroidStudio快捷键设置
- thinkphp的dump函数无输出
- 买饮料难题