标签:des style http color os strong io for
原题http://acm.timus.ru/problem.aspx?space=1&num=1804
Description
Input
Output
Sample Input
input |
---|
2 The Machinegunners played home game, scored 28 goals, and conceded 0 goals. The Machinegunners played home game, scored 1 goals, and conceded 1 goals. |
output |
0 1 1 29 |
#include <string.h> #include <stdio.h> int main() { int t,a,b,i,j; char str[10]; scanf("%d",&t); while(t--) { scanf("%*s%*s%*s%s%*s%*s%d%*s%*s%*s%d%*s",str,&a,&b);//%*s代表一个单词和一个字符串 if(strcmp(str,"home") == 0) { for(i=0;i<=30;i++) { if(a+i > b) { printf("%d ",i); break; } else if(a+i == b && i>=b) { printf("%d ",i); break; } } for(i=30;i>=0;i--) { if(a+i < b+30) { printf("%d\n",i); break; } else if(a+i == b+30 && i<=b) { printf("%d\n",i); break; } } } else if(strcmp(str,"away")==0) { for(i=0;i<=30;i++) { if(a+i > b) { printf("%d ",i); break; } else if(a+i == b) { printf("%d ",i); break; } } for(i=30;i>=0;i--) { if(a+i<b+30 && i>= b) { printf("%d\n",i); break; } else if(a+i == b+30 && a <= 30) { printf("%d\n",i); break; } } } } return 0; }
标签:des style http color os strong io for
原文地址:http://blog.csdn.net/zcr_7/article/details/38167531