1. 程式人生 > >VK Cup 2017 Round 3 + Codeforces Round #412

VK Cup 2017 Round 3 + Codeforces Round #412

for not 暴力枚舉 exgcd sin round ack success 分類討論

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