码迷,mamicode.com
首页 > 其他好文 > 详细

VK Cup 2017 Round 3 + Codeforces Round #412

时间:2017-05-27 10:30:51      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:不等式   cup   success   hacks   div   code   枚举   需要   ack   

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

标签:不等式   cup   success   hacks   div   code   枚举   需要   ack   

原文地址:http://www.cnblogs.com/supy/p/6911295.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!