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
 #include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
int par[];
int main(){
int i,j;
int x,y,giff;
int a,b,diff;
int n,m;scanf("%d%d",&n,&m);
for(i=;i<m;i++){
scanf("%d%d",&a,&b);
diff=a-b;
for(j=;j<=n;j++){
scanf("%d%d",&x,&y);
giff=x-y;
if(diff){if(diff*giff>)par[j]+=;}
else if(!giff)par[j]+=;
if(diff==giff)par[j]+=;
if(x==a)par[j]++;
if(y==b)par[j]++;
}
}
printf("%d",par[]);
for(i=;i<=n;i++)printf(" %d",par[i]);
return ;
}

SGU 405 Totalizator的更多相关文章

  1. IIS7.5上的REST服务的Put,Delete操作发生HTTP Error 405.0 - Method Not Allowed 解决方法

    WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...

  2. 程序中使用ajax时,type为put,或者delete时在 IIS上没效果,发生HTTP Error 405.0 - Method Not Allowed

    其实使用put delete  是在创建webapi中基本才会使用. WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协 ...

  3. restful 部署 PUT,DELETE 请求发生405 谓词Http不允许

    在部署Restful服务的时候,发现中间有个PUT请求的服务,报405 谓词HTTP 不允许解决方法:卸载WebDav 如果不行可以尝试下另一种方式:

  4. 使用wcf服务捕捉到“POST http://yourIP/WCFService.svc 405 (Method Not Allowed) ”错误!

    在程序中使用了一个wcf服务,调试时无任何问题(win7 64位,iis6.1),发布到部门服务器上没有问题(server2008 64位),但是部署到实际服务器上时(server2008 iis6. ...

  5. IIS7.5上的REST服务的Put操作发生HTTP Error 405.0 - Method Not Allowed 解决方法

    WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...

  6. HTTP 405 错误 – 方法不被允许 (Method not allowed)

    HTTP 协议定义一些方法,以指明为获取客户端(如您的浏览器或我们的 CheckUpDown 机器人)所指定的具体网址资源而需要在 Web 服务器上执行的动作.则这些方法如下: 介绍 OPTIONS( ...

  7. 解决“HTTP/1.1 405 Method not allowed”问题

    Apache.IIS.Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回"HTTP/1.1 405 Method not allowed"错误. 即,将 ...

  8. SGU 495. Kids and Prizes

    水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kil ...

  9. maven自建仓库 Return code : 405

    maven自建仓库jar包上传: jar包上传可以采用在自建仓库上系统上传以及通过配置maven setting.xml以及pom.xml上传. maven通过配置上传需要用户名密码以及maven仓库 ...

随机推荐

  1. 利用JS验证查询参数-选择月份后必须选择年份

    js代码: function queryAgentInfo(){ // 标记 var flag=false; //遍历所有月份 $(".month").each(function( ...

  2. SQLAlchemy-对象关系教程ORM-create

    ORM是建立在SQL语言构造器之上的工具集,用于将Python对象映射到数据库的行,提供了一系列接口用于从数据库中存取对象(行).在ORM 工作时,在底层调用SQL语言构造器的API,这些通用的操作有 ...

  3. JVM性能调优监控工具——jps、jstack、jmap、jhat、jstat、hprof使用详解

    摘要: JDK本身提供了很多方便的JVM性能调优监控工具,除了集成式的VisualVM和jConsole外,还有jps.jstack.jmap.jhat.jstat.hprof等小巧的工具,本博客希望 ...

  4. Codeforces 734C Anton and Making Potions(枚举+二分)

    题目链接:http://codeforces.com/problemset/problem/734/C 题目大意:要制作n个药,初始制作一个药的时间为x,魔力值为s,有两类咒语,第一类周瑜有m种,每种 ...

  5. POJ 3286 How many 0's(数位DP模板)

    题目链接:http://poj.org/problem?id=3286 题目大意: 输入n,m,求[n,m]的所有数字中,0出现的总数是多少,前导零不算. 解题思路: 模板题,设dp[pos][num ...

  6. SQL Server存储过程的删除方法

    SQL Server存储过程的删除方法使我们经常会用到的,下面就为您介绍扩展存储过程的删除方法,如果您对SQL Server存储过程方面感兴趣的话,不妨一看. --清除SQL Server所有的危险扩 ...

  7. Effective STL 学习笔记14: Use reserve to avoid unnecessary reallocations.

    vector 和 string 容器在动态插入一个新的对象时,如果容器内空间不够,该容器会: 重新分配空间 通常的做法是分配当前 Capacity 大小两倍的空间. 将旧空间中的所有元素拷贝进新的空间 ...

  8. CVE-2011-0104 Microsoft Office Excel缓冲区溢出漏洞 分析

    漏洞简述   Microsoft Excel是Microsoft Office组件之一,是流行的电子表格处理软件.        Microsoft Excel中存在缓冲区溢出漏洞,远程攻击者可利用此 ...

  9. python开发学习-day14(jquery、ajax等)

    s12-20160421-day14 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...

  10. 【51nod】1742 开心的小Q

    题解 我们由于莫比乌斯函数如果有平方数因子就是0,那么我们可以列出这样的式子 \(\sum_{i = 1}^{n} \sum_{d|i} (1 - |\mu(d)|)\) 然后枚举倍数 \(\sum_ ...