标签:cond ram main style letters following led .mm reg
Description
Input
Output
Sample Input
input | output |
---|---|
2 Codeforces Gamma Round 512 29.02.16 5 4 A Accepted B Accepted C Accepted E Accepted URKOP 17.10.15 12 11 A Accepted B Wrong Answer B Time Limit Exceeded J Accepted B Accepted J Time Limit Exceeded J Accepted F Accepted E Runtime Error H Accepted E Runtime Error |
+------------------------------+--------+-------------+ |Contest name |Date |ABCDEFGHIJKLM| +------------------------------+--------+-------------+ |Codeforces Gamma Round 512 |29.02.16|ooo.o | +------------------------------+--------+-------------+ |URKOP |17.10.15|oo..xo.o.o.. | +------------------------------+--------+-------------+ |
题目意思:根据每一次比赛的结果生成一个总结的表格,刚开始确实没看懂这是什么意思,尤其是vj上的那个破排版,输出的表格是一半一半的,思路很简单,操作有点麻烦吧。
1 #include<stdio.h> 2 #include<string.h> 3 struct message 4 { 5 char id; 6 char ss[100]; 7 }; 8 int main() 9 { 10 int t,i,j,m,n,k,flag; 11 int num[200]; 12 char s[200],x[200]; 13 scanf("%d",&t); 14 getchar(); 15 for(j=0;j<t;j++) 16 { 17 gets(s); 18 gets(x); 19 struct message a[200]; 20 memset(num,0,sizeof(num)); 21 flag=0; 22 scanf("%d%d",&n,&m); 23 getchar(); 24 for(i=0; i<m; i++) 25 { 26 scanf("%c",&a[i].id); 27 getchar(); 28 gets(a[i].ss); 29 if(strcmp(a[i].ss,"Accepted")==0) 30 { 31 num[a[i].id-‘A‘]=1; 32 } 33 else if(strcmp(a[i].ss,"Accepted")!=0&&num[a[i].id-‘A‘]!=1) 34 { 35 num[a[i].id-‘A‘]=2; 36 } 37 else 38 { 39 continue; 40 } 41 42 } 43 if(flag==0) 44 { 45 printf("+------------------------------+--------+-------------+\n"); 46 printf("|Contest name |Date |ABCDEFGHIJKLM|\n"); 47 printf("+------------------------------+--------+-------------+\n"); 48 flag=1; 49 } 50 printf("|%-30s|%s|",s,x); 51 for(i=0;i<n;i++) 52 { 53 if(num[i]==0) 54 { 55 printf("."); 56 } 57 else if(num[i]==1) 58 { 59 printf("o"); 60 } 61 else if(num[i]==2) 62 { 63 printf("x"); 64 } 65 } 66 for(k=1;k<=13-n;k++) 67 { 68 printf(" "); 69 } 70 printf("|\n"); 71 printf("+------------------------------+--------+-------------+\n"); 72 } 73 return 0; 74 }
标签:cond ram main style letters following led .mm reg
原文地址:https://www.cnblogs.com/wkfvawl/p/9025970.html