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. Git的安装和使用(Linux)【转】

    转自:http://my.oschina.net/fhd/blog/354685 Git诞生于Linux平台并作为版本控制系统率先服务于Linux内核,因此在Linux上安装Git是非常方便的.可以通 ...

  2. linux下定时器介绍2--timer_create等函数集的使用示例

    程序1:采用新线程派驻的通知方式 程序2:通知方式为信号的处理方式 #include <stdio.h>#include <time.h>#include <stdlib ...

  3. echarts 移动端地图数据可视化开发教程

    如上效果图: 以下未代码: <!doctype html> <html lang="en">   <head> <meta charset ...

  4. Python 内置装饰器

    内置的装饰器 ​ 内置的装饰器和普通的装饰器原理是一样的,只不过返回的不是函数,而是类对象,所以更难理解一些. @property ​ 在了解这个装饰器前,你需要知道在不使用装饰器怎么写一个属性. d ...

  5. 基于vue配置axios

    转载地址:https://juejin.im/post/5a02a898f265da43052e0c85 1.背景 在项目开发中ajax请求是必不可缺少 一部分ajax请求不需要loading或则请求 ...

  6. 序列化 json和pickle

    序列化 1. 什么叫序列化 将原本的字典.列表等内容转换成一个字符串的过程就叫做序列化. 2.  json dumps loads    一般对字典和列表序列化 dump load       一般对 ...

  7. Python获取指定文件夹下的文件名

    本文采用os.walk()和os.listdir()两种方法,获取指定文件夹下的文件名. 一.os.walk() 模块os中的walk()函数可以遍历文件夹下所有的文件. os.walk(top, t ...

  8. JAVA 转义字符串中的特殊字符

    package test; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test { pu ...

  9. VS 2015 序列号/密钥/企业版/专业版

    专业版:HMGNV-WCYXV-X7G9W-YCX63-B98R2企业版:HM6NR-QXX7C-DFW2Y-8B82K-WTYJV

  10. spring boot之使用通用Mapper批量添加数据

    通用Mapper是一款针对mybatis进行扩展的轻量级组件,使用起来非常方便.当调用其针对mysql进行批量添加数据的方法时,发现报错,仔细研究了一番,发现是在使用通用Mapper上出现了问题.下面 ...