码迷,mamicode.com
首页 > 其他好文 > 详细

Log Files

时间:2018-05-11 20:37:36      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:cond   ram   main   style   letters   following   led   .mm   reg   

Description

Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But the point is that he had participated in such a number of contests that got totally confused, which problems had already been solved and which had not. So Nikolay conceived to make a program that could read contests’ logs and build beautiful summary table of the problems. Nikolay is busy participating in a new contest so he has entrusted this task to you!

Input

The first line contains an integer n (1 ≤ n ≤ 100). It‘s the number of contests‘ descriptions. Then descriptions are given. The first line of description consists of from 1 to 30 symbols — Latin letters, digits and spaces — and gives the name of contest. It‘s given that the name doesn‘t begin and doesn’t end with a space. In the second line of description the date of contest in DD.MM.YY format is given. It‘s also given that the date is correct and YY can be from 00 to 99 that means date from 2000 till 2099. In the third line of description there are numbers p and s separated by space (1 ≤ p ≤ 13, 0 ≤ s ≤ 100). It‘s amount of problems and Nikolay’s submits in the contest. Then s lines are given. These are submits’ descriptions. Description of each submit consists of the problem‘s letter and the judge verdict separated by space. The letter of the problem is the title Latin letter and all problems are numbered by first p letters of English alphabet. The judge verdict can be one of the following: Accepted, Wrong Answer, Runtime Error, Time Limit Exceeded, Memory Limit Exceeded, Compilation Error.

Output

Print the table, which consists of n+1 lines and 3 columns. Each line (except the first) gives the description of the contest. The first column gives the name of the contest, the second column gives the date of the contest (exactly as it was given in the input), the third column gives the description of the problems. Every description of problems is the line of 13 characters, where the i-th character correlate with the i-th problem. If the problem got verdict Accepted at least one time, this character is ’o’. If the problem was submitted at least once but wasn’t accepted, the character is ’x’. If the problem was just given at the contest but wasn’t submitted, the character is ’.’. Otherwise, the character is ’ ’ (space). Contests in the table must be placed in the same order as in input.
Column with the name of the contest consists of 30 symbols (shorter names must be extended by spaces added to the right to make this length). Columns with the date and description of problems consist of 8 and 13 characters accordingly.
The first line of the table gives the names of columns. The boundaries of the table are formatted by ’|’, ’-’ и ’+’ symbols. To get detailed understanding of the output format you can look at the example.

Sample Input

inputoutput
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 }

 

Log Files

标签:cond   ram   main   style   letters   following   led   .mm   reg   

原文地址:https://www.cnblogs.com/wkfvawl/p/9025970.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!