杭电OJ题 1562 Guess the number解题报告
来源:互联网 发布:中兴g180软件 编辑:程序博客网 时间:2024/06/01 09:14
Guess the number
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1656 Accepted Submission(s): 1241
Total Submission(s): 1656 Accepted Submission(s): 1241
Problem 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
——————————————————————————————————————————————————————
/**************************** *Name:Guess the number.c *Tags:ACM water ****************************/#include <stdio.h>int main(){ int c, a, b, t; int i; scanf("%d", &t); while(t--) { scanf("%d%d%d", &a, &b, &c); for(i = 1000; i <= 9999; i++) { if(i % a == 0 && (i+1) % b == 0 && (i+2) % c == 0) {printf("%d\n", i);break; } } if(i > 9999) { printf("Impossible\n"); } } return 0;}
- 杭电OJ题 1562 Guess the number解题报告
- 杭电OJ题 1391 Number Steps 解题报告
- 杭电OJ题1018 Big Number 解题报告
- 杭电 HDU ACM 1562 Guess the number
- hdu-oj 1562 Guess the number
- 杭电OJ题1033 The 3n + 1 problem解题报告
- 杭电OJ题 1597 find the nth digit解题报告
- 杭电OJ 1209题clock 解题报告
- 杭电OJ题 1106 排序 解题报告
- 杭电OJ 题 1209 Clock 解题报告
- 杭电OJ题 1236 排名 解题报告
- 杭电OJ题 1347 Grandpa is Famous解题报告
- 杭电OJ题 1361 Parencodings解题报告
- 杭电OJ题 1379 DNA Sorting解题报告
- 杭电OJ题 1390 Binary Numbers解题报告
- 杭电OJ题 1393 Weird Clock解题报告
- 杭电OJ题 Goldbach's Conjecture解题报告
- 杭电OJ题 1408 盐水的故事 解题报告
- Request与session与application的区别
- WinDbg分析DMP文件方法完全攻略
- Android源代码的下载、编译和运行
- 自己写的一个Android小程序
- linux中查看**软件安装目录
- 杭电OJ题 1562 Guess the number解题报告
- 修改当前进程访问权限代码
- MySQL 存储引擎
- Eclipse JUNO No Application Items
- PL/SQL连接64位oracle客户端
- 杭电OJ题 1587 Flowers解题报告
- windowsphone中WebBrowser中的页面按级回退功能
- C++11维基百科
- Linux环境下段错误的产生原因及调试方法小结