标签:测试数据 -- 18C pre tput content script tom mis
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 12402 Accepted Submission(s): 8046
1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 int main() 6 { 7 int c; 8 int n,m; 9 cin>>c; 10 while(c--) 11 { 12 scanf("%d%d",&n,&m); 13 if(n%(m+1)==0) 14 printf("Rabbit\n"); 15 else 16 printf("Grass\n"); 17 } 18 return 0; 19 }
刚开始想的,但是不对,分了两种情况n<=m和 n>m ,用数据21 10就能看出问题了
1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 int main() 6 { 7 int c; 8 int n,m; 9 cin>>c; 10 while(c--) 11 { 12 scanf("%d%d",&n,&m); 13 if(n<=m) 14 printf("Grass\n"); 15 else 16 { 17 if(n%m==1) 18 printf("Rabbit\n"); 19 else 20 { 21 printf("Grass\n"); 22 } 23 } 24 } 25 return 0; 26 }
HDU 2188 悼念512汶川大地震遇难同胞——选拔志愿者
标签:测试数据 -- 18C pre tput content script tom mis
原文地址:https://www.cnblogs.com/youpeng/p/10043267.html