杭电 HDU ACM 1562 Guess the number
来源:互联网 发布:2303am网络打印 编辑:程序博客网 时间:2024/06/06 17:34
Guess the number
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3035 Accepted Submission(s): 2281
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
Author
8600
Source
Happy 2007
做这题目简直浪费时间
#include<iostream>using namespace std;int main(){int n,a,b,c,i;cin>>n;while(n--){cin>>a>>b>>c;for(i=1000;i<=9999;i++)if((i%a==0)&&((i+1)%b==0)&&((i+2)%c==0)){cout<<i<<endl;;break;}if(i>9999)cout<<"Impossible"<<endl;}return 0;}
0 0
- 杭电 HDU ACM 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 1562 Guess the number
- 杭电OJ题 1562 Guess the number解题报告
- hdu-oj 1562 Guess the number
- 1562 Guess the number
- hdu.1562.Guess the number
- HDU 5981 Guess the number
- HDOJ(HDU) 1562 Guess the number(水题,枚举就行)
- 杭电ACM HDU 3346 Lucky Number
- 杭电 HDU ACM 1391 Number Steps
- 杭电 HDU ACM 1212 Big Number
- 杭电 HDU ACM 1018 Big Number
- hdoj-1562-Guess the number
- HDOJ 1562 Guess the number
- go 速学 - 11 - 结构
- zoj 3031 / cdoj 430 - Robotruck - Southwestern Europe 2007
- uva 10651 状态压缩DP
- TCP/IP详解笔记(9)
- 黑马程序员——C语言基础——用printf函数、数组和循环结构输出特殊图形
- 杭电 HDU ACM 1562 Guess the number
- 第二章第二十题
- 5.9.2 初始化块和构造器
- 写得很好
- 机器导论
- ZOJ 1002 Fire Net(基础dfs)
- ArrayList & LinkedList & Vector比较
- 经典回溯算法(八皇后问题)详解
- 【第五届河南省程序设计大赛】Metric Matrice