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. Android Bander设计与实现 - 设计

    Binder Android IPC Linux 内核 驱动 摘要 Binder是Android系统进程间通信(IPC)方式之一.Linux已经拥有管道,system V IPC,socket等IPC ...

  2. GDB调试基础

    GDB调试基础 https://lesca.me/archives/gdb-basic-knowledge.html GDB笔记(二):条件断点.命令列表.监视点 https://lesca.me/a ...

  3. activiti源码分析学习

    activiti源码分析学习导语 目前项目中用activiti来做工作流的相关工作,最近遇到一些情况下,公司二次开发的流程图渲染出现了问题,会造成流程图出不来的情况.初步分析数据库中记录以及简单的代码 ...

  4. json字符串与java对象的相互转换(jackson)

    1.java对象转换为json字符串 package com.chichung.json; import com.fasterxml.jackson.core.JsonProcessingExcept ...

  5. django(2)基本指令

    打开 Linux 或 MacOS 的 Terminal (终端)直接在 终端中输入这些命令(不是 python 的 shell中) 如果是 windows 用 cmd(开始 搜索 cmd 或者 快捷键 ...

  6. Java之杨辉三角的实现

    今天突然想温习一下Java的基础,想了想就写写杨辉三角吧 1.直接法,利用二维数组 import java.util.Scanner; public class Second { public sta ...

  7. Spark(一)Spark简介

    一.官网介绍 1 什么是Spark 官网地址:http://spark.apache.org/ Apache Spark 是专为大规模数据处理而设计的快速通用的计算引擎.Spark是UC Berkel ...

  8. js处理局部scroll事件禁止外部scroll滚动解决办法,jquery.mousewheel.js处理时禁止办法说明

    js Code: <script> window.onload = function() { for (i = 0; i < 500; i++) { var x = document ...

  9. 程序设计实习MOOC / 程序设计与算法(二)第二周测验(2018春季)

    递归算法: 1:全排列 总时间限制:  1000ms 内存限制:  65536kB 描述 给定一个由不同的小写字母组成的字符串,输出这个字符串的所有全排列. 我们假设对于小写字母有'a' < ' ...

  10. forms.ModelForm 与 forms.Form

    1. 首先 两者都是forms里的常用类. 2. 这两个类在应用上是有区别的.一般情况下,如果要将表单中的数据写入数据库或者修改某些记录的值,就要让表单类继承ModelForm; 如果提交表单后 不会 ...