RCC 2014 Warmup (Div. 2) ABC
A. Elimination
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.
The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rating list. Each of the additional elimination rounds consists of d problems. The winner of the additional round is one person. Besides, k winners of the past finals are invited to the finals without elimination.
As a result of all elimination rounds at least n·m people should go to the finals. You need to organize elimination rounds in such a way, that at least n·m people go to the finals, and the total amount of used problems in all rounds is as small as possible.
The first line contains two integers c and d (1 ≤ c, d ≤ 100) — the number of problems in the main and additional rounds, correspondingly. The second line contains two integers n and m (1 ≤ n, m ≤ 100). Finally, the third line contains an integer k (1 ≤ k ≤ 100) — the number of the pre-chosen winners.
In the first line, print a single integer — the minimum number of problems the jury needs to prepare.
1 10
7 2
1
2
2 2
2 1
2
0
题意 :淘汰赛分为主赛和附加赛,主赛一轮有c道题,附加赛一轮有d道题,主赛每轮可以选拔出n个人,附加赛每次可以选出1个人,还有k个人不用参加淘汰赛,要求最后要选出m×n个人主办方需要准备的最少的题目是多少。
#include <stdio.h>
#include <string.h>
#include <iostream> using namespace std ; int main()
{
int c,d ;
int n,m ;
int k ;
while(~scanf("%d %d",&c,&d))
{
scanf("%d %d %d",&n,&m,&k) ;
if(n * m - k <= )
{
printf("0\n") ;
continue ;
}
int a = n*m-k ;
int ans = ;
if(c < d*n)
{
int x = a / n ;
ans += x*c ;
int y = a % n ;
ans += min(c,d*y) ;
}
else
ans = a * d ;
printf("%d\n",ans) ;
}
return ;
}
B. Crash
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
During the "Russian Code Cup" programming competition, the testing system stores all sent solutions for each participant. We know that many participants use random numbers in their programs and are often sent several solutions with the same source code to check.
Each participant is identified by some unique positive integer k, and each sent solution A is characterized by two numbers: x — the number of different solutions that are sent before the first solution identical to A, and k — the number of the participant, who is the author of the solution. Consequently, all identical solutions have the same x.
It is known that the data in the testing system are stored in the chronological order, that is, if the testing system has a solution with number x (x > 0) of the participant with number k, then the testing system has a solution with number x - 1 of the same participant stored somewhere before.
During the competition the checking system crashed, but then the data of the submissions of all participants have been restored. Now the jury wants to verify that the recovered data is in chronological order. Help the jury to do so.
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the number of solutions. Each of the following n lines contains two integers separated by space x and k (0 ≤ x ≤ 105; 1 ≤ k ≤ 105) — the number of previous unique solutions and the identifier of the participant.
A single line of the output should contain «YES» if the data is in chronological order, and «NO» otherwise.
2
0 1
1 1
YES
4
0 1
1 2
1 1
0 2
NO
4
0 1
1 1
0 1
0 2
YES
题意 :每一个上交的答案都有两个标志,x和k,代表k这个人交的第x个不一样的答案,然后给你n个x和k,问你是不是按照时间排得序,而这个按照时间排序的要求就是对于每一个大于0的x,都要求在前边出现过同一个人交过的x-1.否则输出NO
#include <stdio.h>
#include <string.h>
#include <iostream> using namespace std ; int a[] ;
int main()
{
int n,x,k ;
while(~scanf("%d",&n))
{
bool flag = false ;
memset(a,-,sizeof(a)) ;
for(int i = ; i <= n ; i++)
{
scanf("%d %d",&x,&k) ;
if(a[k] == x-)
a[k]++ ;
else if(a[k] < x-)
flag = true ;
}
if(flag) printf("NO\n") ;
else printf("YES\n") ;
}
return ;
}
C. Football
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided inton teams and played several matches, two teams could not play against each other more than once.
The appointed Judge was the most experienced member — Pavel. But since he was the wisest of all, he soon got bored of the game and fell asleep. Waking up, he discovered that the tournament is over and the teams want to know the results of all the matches.
Pavel didn't want anyone to discover about him sleeping and not keeping an eye on the results, so he decided to recover the results of all games. To do this, he asked all the teams and learned that the real winner was friendship, that is, each team beat the other teams exactly k times. Help Pavel come up with chronology of the tournir that meets all the conditions, or otherwise report that there is no such table.
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won against the team with number bi. You can assume, that the teams are numbered from1 to n.
If a tournir that meets the conditions of the problem does not exist, then print -1.
3 1
3
1 2
2 3
3 1
题意 :就是n个队,每个队都刚好赢了其他队k次,当然,人两个队打比赛都不能超过两次。输出两个队的对号,前者赢了后者。
#include <iostream>
#include <stdio.h>
#include <string.h> using namespace std; int main()
{
int n ,k;
while(scanf("%d %d",&n,&k) != EOF)
{
if(k* >= n)
{
printf("-1\n") ;
continue ;
}
printf("%d\n",n*k) ;
for(int i = ; i <= n ; i++)
for(int j = i+ ; j <= i+k ; j++)
printf("%d %d\n",i,(j-) % n+) ;
}
return ;
}
RCC 2014 Warmup (Div. 2) ABC的更多相关文章
- RCC 2014 Warmup (Div. 2)
一场很很多HACK的比赛,PREtest太弱了,真的很多坑!平时练习的时候很少注意这些东西了! A:开始一直在模拟,后来发现自己的思路逻辑很乱,果然做比赛不给力! 直接在代码中解释了 #include ...
- RCC 2014 Warmup (Div. 2) A~C
近期CF的pretext真是一场比一场弱.第一次在CF上被卡cin.cout.... A. Elimination time limit per test 1 second memory limit ...
- RCC 2014 Warmup (Div. 1)
A 暴力 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm& ...
- RCC 2014 Warmup (Div. 2) 蛋疼解题总结
A. Elimination time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #247 (Div. 2) ABC
Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431 代码均已投放:https://github.com/illuz/Wa ...
- Codeforces Round #312 (Div. 2) ABC题解
[比赛链接]click here~~ A. Lala Land and Apple Trees: [题意]: AMR住在拉拉土地. 拉拉土地是一个很漂亮的国家,位于坐标线.拉拉土地是与著名的苹果树越来 ...
- Codeforces Round #419 (Div. 2) ABC
python 2.7,用来熟悉Python 由于都是智障题,所以我也不讲述题意和题解,直接贴代码了-- A import sys h,m = map(int,raw_input().split(&qu ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2)---ABC
A---The King's Race http://codeforces.com/contest/1075/problem/A 题意: 一个人在\((1,1)\), 一个人在\((n,n)\), 现 ...
随机推荐
- win7 服务详解-系统优化
Adaptive Brightness监视氛围光传感器,以检测氛围光的变化并调节显示器的亮度.如果此服务停止或被禁用,显示器亮度将不根据照明条件进行调节.该服务的默认运行方式是手动,如果你没有使用触摸 ...
- iOS开发基础之排序
Objective-C 有排序的API,省了我们很多事. 主要有以下3种方法. NSComparator NSArray *unsortedArray = @[@5,@3,@8,@1,@7]; NSA ...
- 编程之美 ---> 1.2中国象棋将帅问题
上图,将帅不能碰面,列出将帅不碰面的所有可能情况,要求:程序只能用一个只有8位的变量(#define这样的就不算了) 为了更加符合程序员的口味,给将帅位置编号如下: 0--1--2 | | ...
- 【Linux】rsync同步文件 & 程序自启动
rsync使用 1. 为什么使用rsync? rsync解决linux系统下文件同步时, 增量同步问题. 使用场景: 线上需要定时备份数据文件(视频资源), 使用rsync完成每天的增量备份. 参见: ...
- CCNA第一讲笔记
园区网:一组连续的局域网(校园网.企业内部网) 园区网拓扑: 一层楼的PC连接到一台交换机(同一层的PC可以互联):一栋楼的每层的交换机连接到同一台交换机(整栋楼的PC可以互联):每栋楼的交换机连接到 ...
- JavaScript jQuery 入门回顾 2
JQuery 滑动 利用jQuery可以在元素上创建滑动效果. slideDown() 向下滑动元素. slideUp() 向上滑动元素. slideToggle() 在 slideDown() 与 ...
- WinForm条码打印
在这篇博客中,我曾经介绍了如何实现条形码的生成(生成jpg格式的图片),这篇博客借用上面生成的条码,能够实现条形码的打印功能. 出于批量打印操作的方便以及操作体验考虑,我选择了WinForm.功能很简 ...
- [SQL Server]树形结构的创建
对于SQL Server来说,构建显示一个树形结构不是一件容易的事情,逻辑构造能力不是它的强项.不过也不是说它没有能力干这个事情,只要换一种思维方式就可以理解它的工作原理. 例如,现在有一张表的内容如 ...
- 去掉iphone手机滑动默认行为
/*去掉iphone手机滑动默认行为*/ $('body').on('touchmove', function (event) { event.preventDefault(); });
- Think PHP 提示验证码输入错误
最近遇到一个项目中用的是Thinkphp这个框架开发的,其中在登录这块有验证码这个功能,其实这个功能是TP自带的,其中主要方法是buildImageVerify,位于ThinkPHP\Extend\L ...