Codeforces Round #763 DIV2 D問題 (2500pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
static int sz, arr[1d6];
REP(rd_int()){
int @X, @Y, @NX--, @NY--, @TX--, @TY--, @P, dx = 1, dy = 1;
Modint res = 0, pp, ppw, tmp, c1, c2;
sz = 0;
rep(i,2*(X-1)*(Y-1)){
if(NX==TX || NY==TY) arr[sz++] = i;
if(NX+dx < 0 || NX+dx >= X) dx = -dx;
if(NY+dy < 0 || NY+dy >= Y) dy = -dy;
(NX, NY) += (dx, dy);
}
pp = Modint(P) / 100;
ppw = (1 - pp) ** sz;
c1 = pp / (1 - ppw);
c2 = 2*(X-1)*(Y-1) * pp * ppw / (1-ppw) / (1-ppw);
tmp = 1;
rep(i,sz){
res += tmp * (c1 * arr[i] + c2);
tmp *= 1-pp;
}
wt(res);
}
Current time: 2024年05月19日05時11分44秒
Last modified: 2021年12月29日20時59分01秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF763 CF_DIV2_D
トップページに戻る
Logged in as: unknown user (not login)