A. Is it rated?

题面

Is it rated?

Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.

Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and after the round is known.

It's known that if at least one participant's rating has changed, then the round was rated for sure.

It's also known that if the round was rated and a participant with lower rating took a better place in the standings than a participant with higher rating, then at least one round participant's rating has changed.

In this problem, you should not make any other assumptions about the rating system.

Determine if the current round is rated, unrated, or it's impossible to determine whether it is rated of not.

题意

没有!QAQ

代码

#include <bits/stdc++.h>
using namespace std; int n;
int x,y,ans;
int a[1010];
int b[1010];
int cnt;
int sum1;
int smu2;
bool flag1;
bool flag2;
bool flag3; int main()
{
cin>>n;
for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
for (int i=1;i<=n;i++)
if (a[i]!=b[i]) return 0*puts("rated");
for (int i=1;i<n;i++) if (a[i]>=a[i+1]) ;else return 0*puts("unrated");
return 0*puts("maybe");
}

B. T-Shirt Hunt

题面

Not so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt.

Unfortunately, you didn't manage to get into top 25, but you got into top 500, taking place p.

Now the elimination round of 8VC Venture Cup 2017 is being held. It has been announced that the Codecraft-17 T-shirt winners will be chosen as follows. Let s be the number of points of the winner of the elimination round of 8VC Venture Cup 2017. Then the following pseudocode will be executed:

i := (s div 50) mod 475
repeat 25 times:
i := (i * 96 + 42) mod 475
print (26 + i)

Here "div" is the integer division operator, "mod" is the modulo (the remainder of division) operator.

As the result of pseudocode execution, 25 integers between 26 and 500, inclusive, will be printed. These will be the numbers of places of the participants who get the Codecraft-17 T-shirts. It is guaranteed that the 25 printed integers will be pairwise distinct for any value of s.

You're in the lead of the elimination round of 8VC Venture Cup 2017, having x points. You believe that having at least y points in the current round will be enough for victory.

To change your final score, you can make any number of successful and unsuccessful hacks. A successful hack brings you 100 points, an unsuccessful one takes 50 points from you. It's difficult to do successful hacks, though.

You want to win the current round and, at the same time, ensure getting a Codecraft-17 T-shirt. What is the smallest number of successful hacks you have to do to achieve that?

题意

问成功hack几次,能达到一个玄学分数,该分数弄出来的名字有自己

代码

#include <bits/stdc++.h>
using namespace std; int p,x,y;
int ans; bool ret(int k)
{
int i = (k / 50) % 475 ;
for (int j=1;j<=25;j++)
{
i = (i * 96 + 42) % 475;
if (i+26==p) return 1;
}
return 0;
} int main()
{
cin>>p>>x>>y;
int xx=x;
while (xx>=y) xx-=50;
y=xx+50;
for (int i=0;;i++) if (ret(y+i*50))
{
cout<<max(((y+i*50-x)/50+1)/2,0);
return 0;
} }

C. Success Rate

题面

You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y.

Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q?

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0).

It is guaranteed that p / q is an irreducible fraction.

Hacks. For hacks, an additional constraint of t ≤ 5 must be met.

题意

已经有y次提交,x次正确,问需要几次补充,能达到p/q的正确率?

唉,我想到枚举,为啥就想不到二分呢。。。

官方提示

二分。

代码

#include <bits/stdc++.h>
using namespace std; int t;
using ll=long long;
ll x,y,p,q; bool check(ll k)
{
if (k*p>=x && q*k>=y && q*k-y>=k*p-x) return 1;
else return 0;
} ll binary(ll l,ll r)
{
if (l==r)
{
if (check(l)) return (q*l-y);
else return -1;
}
ll mid{(l+r)>>1};
if (check(mid)) return binary(l,mid);
else return binary(mid+1,r);
} int main()
{
cin>>t;
while (t--)
{
cin>>x>>y>>p>>q;
cout<<binary(1,0x7fffffff)<<endl;
}
}

D. Dynamic Problem Scoring

题面

题意

代码

//

E. Prairie Partition

题面

题意

代码

//

F. Perishable Roads

题面

题意

代码

//

赛后总结

作为一名选手,我还是敬佩和欣赏tourist的,但是作为出题的人话。。

我真想打死他。

题目难到我的话,我其实无所谓的=A=

但是这种题意让人理解起来真的很恶心。

很令人失望的一场比赛

还有坑 日后再填

比赛链接

http://codeforces.com/contest/807

Codeforces Round#412 Div.2的更多相关文章

  1. Codeforces Round #412 Div. 2 第一场翻水水

    大半夜呆在机房做题,我只感觉智商严重下降,今天我脑子可能不太正常 A. Is it rated? time limit per test 2 seconds memory limit per test ...

  2. Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring

    D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  3. Codeforces Round #412 (Div. 2)ABCD

    tourist的剧毒contest,题干长到让人不想做... A.看不太懂题意直接看下面input output note n组里有两数不一样的一组就rated 否则单调不增为maybe,否则unra ...

  4. 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 ...

  5. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  6. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  7. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  8. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  9. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

随机推荐

  1. java_3选择与循环

    1.三种执行顺序(流程控制语句) 在Java中,有三种执行结构,第一种:顺序结构.第二种:循环结构.第三种:选择结构. 2.顺序结构 自上而下,顺序执行. 3.循环结构 (1)while语句 初始化表 ...

  2. mysql 事务中如果有sql语句出错,会导致自动回滚吗?

    事务,我们都知道具有原子性,操作要么全部成功,要么全部失败.但是有可能会造成误解. 我们先准备一张表,来进行测试 CREATE TABLE `name` ( `id` int(11) unsigned ...

  3. Oracle 表空间和数据文件之间的关系

    首先,你需要明白的一点是:数据库的物理结构是由数据库的操作系统文件所决定,每一个Oracle数据库是由三种类型的文件组成:数据文件.日志文件和控制文件.数据库的文件为数据库信息提供真正的物理存储. 每 ...

  4. sqlserver数据库的备份与还原——完整备份与还原

    sqlserver提供四种数据库备份方式 完整备份:备份整个数据库的所有内容包括书屋和日志 差异备份:只备份上次完整备份后更高的数据部分 事务日志备份:只备份事务日志里的内容 文件或文件组备份:只备份 ...

  5. Javascript 四种输出方式

    JavaScript 输出 javascript 没有任何打印或输出的函数 可以通过不同的方式输出数据 使用window.alert() 弹出警告框 使用document.write()方法将内容写到 ...

  6. u-boot之ARM920T的start.S分析

    cpu/arm920t/start.S程序步骤大致有以下几个 1.设置中断向量表 2.设置CPU模式为SVC32 mode并且关闭IRQ与FIQ中断 3.关闭看门狗 4.屏蔽所有中断 5.判断程序是否 ...

  7. 27.MySQL备份与恢复

    27.备份与恢复27.1 备份/恢复策略考虑因素:备份表的存储引擎(事务性or非事务性):全备份or增量备份用复制做异地备份定期备份,考虑恢复时间确保mysql打开log-bin,有了BINLOG,M ...

  8. mybatis进阶--mapper输入映射和输出映射

    我们知道,mapper.xml是我们配置操作数据库的sql语句的地方.其中每个sql语句对应着一个方法,每个方法都有自己的输入输出参数类型.那么这些类型都是怎么配置的呢?今天我们来一起学习下. 输入映 ...

  9. 前端面试问题js汇总

    1.javascript的typeof返回哪些数据类型 Object number function boolean underfind 2,数组方法pop() push() unshift()shi ...

  10. Latex基本用法

    空格 需要使用 \qquad,\quad,\,应该是占位符和变量之间需要有{}相隔. $$ C_{1} \qquad {C_2} $$ $$ C_{1} \quad {C_2} $$ $$ C_{1} ...