2019年09月27日04時08分31秒に更新されたバージョンを表示しています.
最新のページはこちらをご覧ください.
AtCoder Beginner Contest 004
問題文
省略
省略
C++に変換後のコードはこちら
int calc(int n, int lf, int rg){
int i, ex = rg - lf + 1 - n;
i = min(max(0,rg-(-lf)), ex);
rg -= i;
ex -= i;
i = min(max(0,(-lf)-rg), ex);
lf += i;
ex -= i;
lf += ex / 2;
rg -= ex /+ 2;
if(lf > 0) return rg * (rg+1) / 2 - lf * (lf-1) / 2;
if(rg < 0) return (-lf) * (-lf+1) / 2 - (-rg) * (-rg-1) / 2;
return rg * (rg+1) / 2 + (-lf) * (-lf+1) / 2;
}
{
int R, G, B, res = int_inf;
rd(R,G,B);
rep(i,-600,300) res <?= calc(R,-int_inf,i-1+100) + calc(G,i,i+G-1) + calc(B,i+G-100,int_inf);
wt(res);
}
Current time: 2024年04月30日16時10分39秒
Last modified: 2019年09月27日04時08分31秒 (by laycrs)
Tags: Competitive_Programming_Incomplete AtCoder AtCoder_Beginner_Contest ABC004 ABC_D
トップページに戻る
Logged in as: unknown user (not login)