首页 > 代码库 > VK Cup 2017 Round 3 + Codeforces Round #412

VK Cup 2017 Round 3 + Codeforces Round #412

A 读题题

B 就是你排名第p,得了x分,而最终至少需要y分,你需要最少的successful hack,使得最终得分s>=y,且由s随机取25个数,使p被选中。

(1)暴力枚举hack成功几次,失败几次就好了

(2)另解:枚举尽可能小的s,使|s-x|=0(mod 50),分类讨论

If s?≤?x, we need 0 successful hacks, since we can just make (x?-?s)?/?50 unsuccessful hacks.

If s?>?x and s?-?x is divisible by 100, we need exactly (s?-?x)?/?100 successful hacks.

If s?>?x and s?-?x is not divisible by 100, we need (s?-?x?+?50)?/?100 successful hacks and one unsuccessful hack.

 

C 一看到题就打了exgcd,调了一晚上,各种看错,最后发现爆long long了。。

其实列个不等式解就好了

VK Cup 2017 Round 3 + Codeforces Round #412