SGU 405 Totalizator
405. Totalizator
Memory limit: 65536
kilobytes
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.
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 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.
sample input |
sample output |
1 2 |
6 |
sample input |
sample output |
2 3 |
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的更多相关文章
- IIS7.5上的REST服务的Put,Delete操作发生HTTP Error 405.0 - Method Not Allowed 解决方法
WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...
- 程序中使用ajax时,type为put,或者delete时在 IIS上没效果,发生HTTP Error 405.0 - Method Not Allowed
其实使用put delete 是在创建webapi中基本才会使用. WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协 ...
- restful 部署 PUT,DELETE 请求发生405 谓词Http不允许
在部署Restful服务的时候,发现中间有个PUT请求的服务,报405 谓词HTTP 不允许解决方法:卸载WebDav 如果不行可以尝试下另一种方式:
- 使用wcf服务捕捉到“POST http://yourIP/WCFService.svc 405 (Method Not Allowed) ”错误!
在程序中使用了一个wcf服务,调试时无任何问题(win7 64位,iis6.1),发布到部门服务器上没有问题(server2008 64位),但是部署到实际服务器上时(server2008 iis6. ...
- IIS7.5上的REST服务的Put操作发生HTTP Error 405.0 - Method Not Allowed 解决方法
WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...
- HTTP 405 错误 – 方法不被允许 (Method not allowed)
HTTP 协议定义一些方法,以指明为获取客户端(如您的浏览器或我们的 CheckUpDown 机器人)所指定的具体网址资源而需要在 Web 服务器上执行的动作.则这些方法如下: 介绍 OPTIONS( ...
- 解决“HTTP/1.1 405 Method not allowed”问题
Apache.IIS.Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回"HTTP/1.1 405 Method not allowed"错误. 即,将 ...
- SGU 495. Kids and Prizes
水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kil ...
- maven自建仓库 Return code : 405
maven自建仓库jar包上传: jar包上传可以采用在自建仓库上系统上传以及通过配置maven setting.xml以及pom.xml上传. maven通过配置上传需要用户名密码以及maven仓库 ...
随机推荐
- 虚拟机使用主机ss代理
环境Linux mint 设置好主机ss代理,并开启[允许来自局域网的链接] 在Linux虚拟机的system setting-network手动设置代理 地址全部填入刚刚的主机地址,端口号为主机ss ...
- .net 运行中出现的错误解决方法记录
1.应用程序无法启动,因为应用程序的并行配置不正确.有关详细信息,请参阅应用程序事件日志,或使用命令行sxstrace.exe工具. https://jingyan.baidu.com/article ...
- 2018 ICPC 徐州网络赛
2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...
- 数论-求n以内的质数
一.埃拉托斯特尼筛法 名字很高大上,然而并没有什么卵用…… 思路: 在把<=√n的质数所有的<=n的倍数剔除,剩下的就都是质数了,很容易理解…… 复杂度O(nloglogn) #inclu ...
- Prepare tasks for django project deployment.md
As we know, there are some boring tasks while deploy Django project, like create db, do migrations a ...
- 002_IO磁盘深入理解
一.如何测试云硬盘 https://www.ustack.com/blog/how-benchmark-ebs/#fio
- java基础78 Servlet的生命周期
1.Servlet的生命周期 简单的解析就是: 创建servlet实例(调用构造器)---->调用init()方法---->调用service()方法----->调用destroy( ...
- group by 和 distinct 去重比较
distinct方式就是两两对比,需要遍历整个表.group by分组类似先建立索引再查索引,所以两者对比,小表destinct快,不用建索引.大表group by快.一般来说小表就算建索引,也不会慢 ...
- Ubuntu下apache2启动、停止、重启、配置
Linux系统为Ubuntu 一.Start Apache 2 Server /启动apache服务# /etc/init.d/apache2 startor$ sudo /etc/init.d/ap ...
- python3 安装
Centos7 安装python3 #安装sqlite-devel yum -y install sqlite-devel #安装依赖 yum -y install make zlib zlib-de ...