zoukankan      html  css  js  c++  java
  • Log Files

    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.

    Example

    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.. |
    +------------------------------+--------+-------------+
     1 #include <iostream>
     2 #include <stdio.h>
     3 #include <string.h>
     4 #include <algorithm>
     5 #include <math.h>
     6 #include<map>
     7 using namespace std;
     8 map<int,int>::iterator it;
     9 int main()
    10 {
    11     int a,b,n,i,m,x,z,o;
    12     char str[100][111],ch,pp[123],app[1234];
    13     string arr;
    14     map<int,int>mp,mp1;
    15     scanf("%d",&z);
    16     getchar();
    17     for(o=0;o<z;o++)
    18     {
    19 
    20          mp.clear();
    21          memset(str,0,sizeof(str));
    22          gets(str[0]);
    23          gets(str[1]);
    24          scanf("%d%d",&a,&b);
    25          getchar();
    26          for(i=0;i<b;i++)
    27          {
    28             gets(pp);
    29             m=pp[0];
    30             mp[m]++;
    31             if(pp[2]=='A')
    32                  mp[m]=200;
    33 
    34          }
    35          for(i=65;i<=123;i++)
    36            arr[i]='.';
    37         for(it=mp.begin();it!=mp.end();it++)
    38         {
    39           if(it->second>=200)
    40               arr[it->first]='o';
    41           else
    42               arr[it->first]='x';
    43         }
    44         if(o==0)
    45         {
    46             printf("+------------------------------+--------+-------------+
    ");
    47             printf("|Contest name                  |Date    |ABCDEFGHIJKLM|
    ");
    48             printf("+------------------------------+--------+-------------+
    ");
    49         }
    50         printf("|%-30s",str[0]);
    51         printf("|%s|",str[1]);
    52         int l=0;
    53         for(i=65;i<65+a;i++)
    54            app[l++]=arr[i];
    55         app[l]=0;
    56         printf("%-13s|
    ",app);
    57         puts("+------------------------------+--------+-------------+");
    58         //getchar();
    59     }
    60     return 0;
    61 
    62 }
  • 相关阅读:
    ListView滑动位置精准记忆
    2 GPS utility methods
    PingUtil in Android
    Android客户端的图形化拖放操作的设计实现
    腾讯视频去广告代码
    ie9不支持line-height_ie9不支持字体垂直居中兼容问题解决篇_IE9中字体不能垂直居中解决方法
    Web App开发的七个错误
    邮件页面的设计与网页页面设计的区别
    如何在ecshop商品页显示累计销售量
    如何让iframe的背景透明
  • 原文地址:https://www.cnblogs.com/moomcake/p/8973817.html
Copyright © 2011-2022 走看看