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
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 ErrorSample Output
+------------------------------+--------+-------------+ |Contest name |Date |ABCDEFGHIJKLM| +------------------------------+--------+-------------+ |Codeforces Gamma Round 512 |29.02.16|ooo.o | +------------------------------+--------+-------------+ |URKOP |17.10.15|oo..xo.o.o.. | +------------------------------+--------+-------------+
代码如下:
#include<cstdio>
#include<cmath>
#include<map>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int MAX = 1e5 + 10;
typedef long long LL;
int a[MAX];
int main()
{
int t;
cin>>t;
cout<<"+------------------------------+--------+-------------+"<<endl;
cout<<"|Contest name |Date |ABCDEFGHIJKLM|"<<endl;
cout<<"+------------------------------+--------+-------------+"<<endl;
getchar();
while(t--)
{
char s[111]={0},qaq[111]={0};
gets(s);
printf("|%-30s",s);
gets(s);
printf("|%s|",s);
int m,n;
cin>>n>>m;
getchar();
for(int i=0; i<n; i++)
qaq[i]='.';
for(int i=n; i<13; i++)
qaq[i]=' ';
while(m--)
{
gets(s);
if(s[2]=='A')
qaq[s[0]-'A']='o';
if(qaq[s[0]-'A']!='o')
qaq[s[0]-'A']='x';
}
printf("%s|\n",qaq);
cout<<"+------------------------------+--------+-------------+"<<endl;
}
return 0;
}