• SGU 405 Totalizator


    405. Totalizator

    Time limit per test: 0.25 second(s)
    Memory limit: 65536 kilobytes
    input: standard
    output: standard


    Some time ago Vasya was cleaning up the garret. After the hours of hard work he suddenly found the notes of the totalizator, which his grandfather had organised during the XII Berland football championship. It followed from the notes that each participant of the totalizator made his prediction about the result of every match (the result of the match is an ordered pair of numbers  — number of goals scored by the first team and number of goals scored by the second team). Each prediction is such pair of numbers too. Every participant got score for the every prediction he made by the following rules:

    • if he guesses the winner (or a tie), his score is inscreased by 2.
    • if he guesses the difference between the number of goals scored by the first and the second team, his score is inscreased by 3.
    • if he guesses the number of goals scored by the first team, his score is increased by 1.
    • if he guesses the number of goals scored by the second team, his score is increased by 1.

    So, if the participant guesses the exact result of the match, he gets 7 points. Or, for example, if he guesses only the winner and the difference, he scores 5 points. Unfortunately, the list with the results of the totalizator was lost. But Vasya wants to know how many scores each totalizator participant got. Help him to find the scores.

    Input

    The first line contains two integer numbers n and m (1 ≤ n ≤ 100, 1 ≤ m ≤ 100) — the number of participants and the number of games. After it m blocks of n+1 lines follow. Each block corresponds to one match. The first line of each block contains two integer numbers a,b (0 ≤ a,b ≤ 10) — numbers of goals scored by the first and the second team. Other n lines of each block contain predictions of all participants in the same format, the i-th line is a prediction of the i-th participant.

    Output

    Output n numbers separated by spaces — scores of participants. The i-th number should be the score of the i-th participant. Participants are numbered from 1 to n as their predictions are given in the input.

    Example(s)
    sample input
    sample output
    1 2
    3 2
    2 1
    0 2
    0 0
    
    6
    
    sample input
    sample output
    2 3
    4 3
    2 2
    2 0
    0 0
    1 1
    1 0
    5 0
    3 0
    2 0
    
    8 6
    
     1 #include<iostream>  
     2 #include<string.h>  
     3 #include<stdio.h>  
     4 #include<ctype.h>  
     5 #include<algorithm>  
     6 #include<stack>  
     7 #include<queue>  
     8 #include<set>  
     9 #include<math.h>  
    10 #include<vector>  
    11 #include<map>  
    12 #include<deque>  
    13 #include<list>  
    14 using namespace std;
    15 int par[106];
    16 int main(){
    17     int i,j;
    18     int x,y,giff;
    19     int a,b,diff;
    20     int n,m;scanf("%d%d",&n,&m);
    21     for(i=0;i<m;i++){
    22         scanf("%d%d",&a,&b);
    23         diff=a-b;
    24         for(j=1;j<=n;j++){
    25             scanf("%d%d",&x,&y);
    26             giff=x-y;
    27             if(diff){if(diff*giff>0)par[j]+=2;}
    28             else if(!giff)par[j]+=2;
    29             if(diff==giff)par[j]+=3;
    30             if(x==a)par[j]++;
    31             if(y==b)par[j]++;
    32         }
    33     }
    34     printf("%d",par[1]);
    35     for(i=2;i<=n;i++)printf(" %d",par[i]);
    36     return 0;
    37 }
    View Code
  • 相关阅读:
    Java String截取判断文件类型
    HttpServletRequest request 转 Json
    httprunner3.x详细教程七(三种方式实现参数化数据驱动)
    httprunner3.x详细教程六(httprunner的setup和teardown及hook)
    httprunner3.x详细教程五(debugtalk.py介绍)
    httprunner3.x详细教程四(.env文件介绍)
    httprunner3.x详细教程三(httprunner中testcase的构造)
    httprunner3.x详细教程二(har文件录制及har文件转换)
    httprunner3.x详细教程一(框架结构介绍及搭建)
    mybatis.xml和mapper.xml文件的基本配置
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3880009.html
Copyright © 2020-2023  润新知