csp-s模拟测试88
最近太丧了,总是莫名伤感,可能是秋天到了吧。
考场砸$T2$了,在厕所里想好了$T1$的二分思路,出来后先码完$T2$,十分钟又给$T3$写了一个$n!$,$T1$写了一个死亡二分就开始自闭了。作为一个很废很渣的人我的本愿是干掉$T2$并看见机房一半人干掉它,$T1$水到$50$多点就结束的。出来后发现$T2Wa$了就很难受,并不知道哪里打挂。习惯性的倒着凡榜却发现$T1$ $95$分????
95
03:15:10
|
80
02:59:19
|
10
03:17:19
|
185
03:17:19
|
大约是这个样子。
????我$T1$水到了$95$??我第二个小样例过不去啊!
再看看别的大佬,都是过掉了$T3$,只有我一个垃圾靠$T2$混在里面。。。
A. 军训队列
正解没水平我来讲一个错解!!!(当然我的错解在范围大的时候有很大的正确性 小点简单点跑暴力别犟这个。
对于大点,将$k$个队列看作$k$个背包,我们固定一个最大背包容量,具体指背包内最大值与最小值的差,然后就可以发现这个容量可以二分,大概流程是二分容量,$Check$一下,求出来一个合适的可以正好放$k$组的一个容量,用这个容量分组,进行计算。当然它是错的,但是由于$n>>k$,他可以拿到所有大数据的分数。(强烈谴责**数据卡我$AC$
1 #include <bits/stdc++.h> 2 using namespace std; 3 4 #define QAQ 123333 5 #define re register 6 #define fup(i,a,b) for(re int i(a);i<=b;++i) 7 #define fdn(i,a,b) for(re int i(a);i>=b;--i) 8 9 int n,K; 10 double anss; 11 double a[QAQ]; 12 13 inline int read() { 14 re int x(0); re char ch(getchar()); 15 while(ch>'9'||ch<'0') ch=getchar(); 16 while(ch<='9'&&ch>='0') x=(x<<3)+(x<<1)+(ch^48),ch=getchar(); 17 return x; 18 } 19 20 void Cheat_for_get() { 21 static double f[5555][5555]; fup(i,0,n) fup(k,0,K) f[i][k]=1e18; f[0][0]=0; 22 fup(i,1,n) fup(k,1,K) fup(j,1,i) f[i][k]=min(f[i][k],f[j-1][k-1]+(a[i]-a[j])*(a[i]-a[j])); 23 printf("%.2lf ",f[n][K]); 24 } 25 26 bool Check(double x) { 27 int st=1,pos=1,zs=1; 28 while(pos<=n) { 29 if(a[pos]-a[st]<=x) ++pos; 30 else ++zs,st=pos,++pos; 31 if(zs>K) return false; 32 } 33 return zs<=K; 34 } 35 36 int main() { 37 n=read(); K=read(); 38 if(K>n) puts("0.00"),exit(0); 39 fup(i,1,n) scanf("%lf",&a[i]); sort(a+1,a+1+n); if(K==1) printf("%.2lf ",(a[n]-a[1])*(a[n]-a[1])), exit(0); 40 if(K==2) { double ans=1e18; fup(i,2,n-1) ans=min(ans,(a[i-1]-a[1])*(a[i-1]-a[1])+(a[n]-a[i])*(a[n]-a[i])); printf("%.2lf ",ans); exit(0); } 41 if(n<=1111) Cheat_for_get(),exit(0); 42 double l=0,r=200,ans; 43 while(r-l>=1e-2) { 44 double mid=(l+r)/2; 45 if(Check(mid)) ans=mid,r=mid; 46 else l=mid; 47 } 48 int st=1,pos=1,zs=1; 49 while(pos<=n) { 50 if(a[pos]-a[st]<=ans) ++pos; 51 else { 52 anss+=(a[pos-1]-a[st])*(a[pos-1]-a[st]); 53 ++zs,st=pos,++pos; 54 } 55 } 56 anss+=(a[n]-a[st])*(a[n]-a[st]); 57 printf("%.2lf ",anss); 58 59 }
B. 山屋惊魂
(我才不是为了装X才写博客的
水题,按住他就是********。
对于判定 性操作(蜜汁空格),记得分判定成功和判定失败去跑,打完以后我发现它跑不对样例。
(在运行中查错
才想起来自己的判定不对,于是按住一句代码复制了几十遍。
后来又发现多复制了一句话。
然后回过头来去把它注释掉,考完发现手一抖注释歪了一行把它的上一行注释了(当场去世
好了就是这样我就是想来放一个代码。
1 #include <bits/stdc++.h> 2 using namespace std; 3 4 #define QAQ 123 5 #define re register 6 #define double long double 7 #define fup(i,a,b) for(re int i(a);i<=b;++i) 8 #define fdn(i,a,b) for(re int i(a);i>=b;--i) 9 10 int n; 11 double dead; 12 double guess[20][40]; 13 int st[4];double ed[4][10]; 14 char first[20],second[20]; 15 double f[QAQ][9][9][9][9]; 16 int Might[10],Speed[10],Sanity[10],Knowledge[10]; 17 18 inline int read() { 19 re int x(0); re char ch(getchar()); 20 while(ch>'9'||ch<'0') ch=getchar(); 21 while(ch<='9'&&ch>='0') x=(x<<3)+(x<<1)+(ch^48),ch=getchar(); 22 return x; 23 } 24 25 int main() { 26 guess[0][0]=1; 27 fup(i,1,19) fup(j,0,29) { 28 if(1>0) guess[i][j]+=guess[i-1][j-0]/3; 29 if(j>0) guess[i][j]+=guess[i-1][j-1]/3; 30 if(j>1) guess[i][j]+=guess[i-1][j-2]/3; 31 } 32 fup(i,1,8) scanf("%1d",&Might[i]); st[0]=read(); 33 fup(i,1,8) scanf("%1d",&Speed[i]); st[1]=read(); 34 fup(i,1,8) scanf("%1d",&Sanity[i]); st[2]=read(); 35 fup(i,1,8) scanf("%1d",&Knowledge[i]); st[3]=read(); 36 f[0][st[0]][st[1]][st[2]][st[3]]=100; n=read(); 37 fup(tim,0,n-1) { 38 scanf("%s",first+1); re char ch(getchar()); 39 while(ch==' ') ch=getchar(); 40 if(ch=='+') 41 { 42 re int num; num=getchar()^48; char now=getchar(); 43 if(now!='?') 44 { 45 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 46 { 47 if(f[tim][i][j][k][l]>0) 48 { 49 switch(first[2]) 50 { 51 case 'i' : 52 { 53 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]; break; 54 } 55 case 'p' : 56 { 57 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]; break; 58 } 59 case 'a' : 60 { 61 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]; break; 62 } 63 case 'n' : 64 { 65 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]; break; 66 } 67 } 68 } 69 } 70 } 71 else 72 { 73 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 74 { 75 if(f[tim][i][j][k][l]>0) 76 { 77 switch(first[2]) 78 { 79 case 'i' : 80 { 81 fup(r,0,(num<<1)) 82 { 83 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*guess[num][r]; 84 } 85 break; 86 } 87 case 'p' : 88 { 89 fup(r,0,(num<<1)) 90 { 91 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*guess[num][r]; 92 } 93 break; 94 } 95 case 'a' : 96 { 97 fup(r,0,(num<<1)) 98 { 99 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*guess[num][r]; 100 } 101 break; 102 } 103 case 'n' : 104 { 105 fup(r,0,(num<<1)) 106 { 107 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*guess[num][r]; 108 } 109 break; 110 } 111 } 112 } 113 } 114 } 115 } 116 else if(ch=='-') 117 { 118 re int num; num=getchar()^48; char now=getchar(); 119 if(now!='?') 120 { 121 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 122 { 123 if(f[tim][i][j][k][l]>0) 124 { 125 switch(first[2]) 126 { 127 case 'i' : 128 { 129 if(i-num<=0) dead+=f[tim][i][j][k][l]; 130 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]; break; 131 } 132 case 'p' : 133 { 134 if(j-num<=0) dead+=f[tim][i][j][k][l]; 135 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]; break; 136 } 137 case 'a' : 138 { 139 if(k-num<=0) dead+=f[tim][i][j][k][l]; 140 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]; break; 141 } 142 case 'n' : 143 { 144 if(l-num<=0) dead+=f[tim][i][j][k][l]; 145 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]; break; 146 } 147 } 148 } 149 } 150 } 151 else 152 { 153 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 154 { 155 if(f[tim][i][j][k][l]>0) 156 { 157 switch(first[2]) 158 { 159 case 'i' : 160 { 161 fup(r,0,(num<<1)) 162 { 163 if(i-r<=0) dead+=f[tim][i][j][k][l]*guess[num][r]; 164 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*guess[num][r]; 165 } 166 break; 167 } 168 case 'p' : 169 { 170 fup(r,0,(num<<1)) 171 { 172 if(j-r<=0) dead+=f[tim][i][j][k][l]*guess[num][r]; 173 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*guess[num][r]; 174 } 175 break; 176 } 177 case 'a' : 178 { 179 fup(r,0,(num<<1)) 180 { 181 if(k-r<=0) dead+=f[tim][i][j][k][l]*guess[num][r]; 182 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*guess[num][r]; 183 } 184 break; 185 } 186 case 'n' : 187 { 188 fup(r,0,(num<<1)) 189 { 190 if(l-r<=0) dead+=f[tim][i][j][k][l]*guess[num][r]; 191 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*guess[num][r]; 192 } 193 break; 194 } 195 } 196 } 197 } 198 } 199 } 200 else if(ch=='>') 201 { 202 re bool flag=1; 203 re char now=getchar(); 204 if(now=='=') flag=0; 205 re int aim=read()+flag; 206 scanf("%s",second+1); 207 now=getchar(); 208 while(now==' ') now=getchar(); 209 re int num=getchar()^48; 210 if(now=='+') 211 { 212 now=getchar(); 213 if(now!='?') 214 { 215 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 216 { 217 if(f[tim][i][j][k][l]>0) 218 { 219 switch(first[2]) 220 { 221 case 'i' : 222 { 223 double okay=0; 224 fup(q,aim,29) okay+=guess[Might[i]][q]; 225 if(second[2]=='i') 226 { 227 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 228 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 229 } 230 else if(second[2]=='p') 231 { 232 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 233 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 234 } 235 else if(second[2]=='a') 236 { 237 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 238 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 239 } 240 else 241 { 242 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 243 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 244 } 245 break; 246 } 247 case 'p' : 248 { 249 double okay=0; 250 fup(q,aim,29) okay+=guess[Speed[j]][q]; 251 if(second[2]=='i') 252 { 253 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 254 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 255 } 256 else if(second[2]=='p') 257 { 258 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 259 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 260 } 261 else if(second[2]=='a') 262 { 263 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 264 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 265 } 266 else 267 { 268 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 269 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 270 } 271 break; 272 一句 } 273 case 'a' : 274 { 275 double okay=0; 276 fup(q,aim,29) okay+=guess[Sanity[k]][q]; 277 if(second[2]=='i') 278 { 279 一句 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 280 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 281 } 282 else if(second[2]=='p') 283 { 284 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 285 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 286 } 287 else if(second[2]=='a') 288 { 289 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 290 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 291 } 292 else 293 { 294 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 295 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 296 } 297 break; 298 } 299 case 'n' : 300 { 301 double okay=0; 302 fup(q,aim,29) okay+=guess[Knowledge[l]][q]; 303 if(second[2]=='i') 304 { 305 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 306 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 307 } 308 else if(second[2]=='p') 309 { 310 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 311 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 312 } 313 else if(second[2]=='a') 314 { 315 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 316 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 317 } 318 else 319 { 320 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 321 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 322 } 323 break; 324 } 325 } 326 } 327 } 328 } 329 else 330 { 331 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 332 { 333 if(f[tim][i][j][k][l]>0) 334 { 335 switch(first[2]) 336 { 337 case 'i' : 338 { 339 double okay=0; 340 fup(q,aim,29) okay+=guess[Might[i]][q]; 341 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 342 if(second[2]=='i') 343 { 344 fup(r,0,(num<<1)) 345 { 346 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 347 } 348 } 349 else if(second[2]=='p') 350 { 351 fup(r,0,(num<<1)) 352 { 353 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 354 } 355 } 356 else if(second[2]=='a') 357 { 358 fup(r,0,(num<<1)) 359 { 360 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 361 } 362 } 363 else 364 { 365 fup(r,0,(num<<1)) 366 { 367 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 368 } 369 } 370 break; 371 } 372 case 'p' : 373 { 374 double okay=0; 375 fup(q,aim,29) okay+=guess[Speed[j]][q]; 376 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 377 if(second[2]=='i') 378 { 379 fup(r,0,(num<<1)) 380 { 381 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 382 } 383 } 384 else if(second[2]=='p') 385 { 386 fup(r,0,(num<<1)) 387 { 388 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 389 } 390 } 391 else if(second[2]=='a') 392 { 393 fup(r,0,(num<<1)) 394 { 395 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 396 } 397 } 398 else 399 { 400 fup(r,0,(num<<1)) 401 { 402 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 403 } 404 } 405 break; 406 } 407 case 'a' : 408 { 409 double okay=0; 410 fup(q,aim,29) okay+=guess[Sanity[k]][q]; 411 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 412 if(second[2]=='i') 413 { 414 fup(r,0,(num<<1)) 415 { 416 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 417 } 418 } 419 else if(second[2]=='p') 420 { 421 fup(r,0,(num<<1)) 422 { 423 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 424 } 425 } 426 else if(second[2]=='a') 427 { 428 fup(r,0,(num<<1)) 429 { 430 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 431 } 432 } 433 else 434 { 435 fup(r,0,(num<<1)) 436 { 437 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 438 } 439 } 440 break; 441 } 442 case 'n' : 443 { 444 double okay=0; 445 fup(q,aim,29) okay+=guess[Knowledge[l]][q]; 446 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 447 if(second[2]=='i') 448 { 449 fup(r,0,(num<<1)) 450 { 451 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 452 } 453 } 454 else if(second[2]=='p') 455 { 456 fup(r,0,(num<<1)) 457 { 458 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 459 } 460 } 461 else if(second[2]=='a') 462 { 463 fup(r,0,(num<<1)) 464 { 465 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 466 } 467 } 468 else 469 { 470 fup(r,0,(num<<1)) 471 { 472 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 473 } 474 } 475 break; 476 } 477 } 478 } 479 } 480 } 481 } 482 else 483 { 484 now=getchar(); 485 if(now!='?') 486 { 487 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 488 { 489 if(f[tim][i][j][k][l]>0) 490 { 491 switch(first[2]) 492 { 493 case 'i' : 494 { 495 double okay=0; 496 fup(q,aim,29) okay+=guess[Might[i]][q]; 497 if(second[2]=='i') 498 { 499 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 500 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 501 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 502 } 503 else if(second[2]=='p') 504 { 505 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 506 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 507 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 508 } 509 else if(second[2]=='a') 510 { 511 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 512 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 513 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 514 } 515 else 516 { 517 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 518 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 519 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 520 } 521 break; 522 } 523 case 'p' : 524 { 525 double okay=0; 526 fup(q,aim,29) okay+=guess[Speed[j]][q]; 527 if(second[2]=='i') 528 { 529 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 530 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 531 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 532 } 533 else if(second[2]=='p') 534 { 535 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 536 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 537 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 538 } 539 else if(second[2]=='a') 540 { 541 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 542 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 543 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 544 } 545 else 546 { 547 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 548 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 549 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 550 } 551 break; 552 } 553 case 'a' : 554 { 555 double okay=0; 556 fup(q,aim,29) okay+=guess[Sanity[k]][q]; 557 if(second[2]=='i') 558 { 559 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 560 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 561 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 562 } 563 else if(second[2]=='p') 564 { 565 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 566 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 567 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 568 } 569 else if(second[2]=='a') 570 { 571 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 572 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 573 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 574 } 575 else 576 { 577 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 578 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 579 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 580 } 581 break; 582 } 583 case 'n' : 584 { 585 double okay=0; 586 fup(q,aim,29) okay+=guess[Knowledge[l]][q]; 587 if(second[2]=='i') 588 { 589 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 590 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 591 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 592 } 593 else if(second[2]=='p') 594 { 595 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 596 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 597 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 598 } 599 else if(second[2]=='a') 600 { 601 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 602 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 603 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 604 } 605 else 606 { 607 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 608 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 609 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 610 } 611 break; 612 } 613 } 614 } 615 } 616 } 617 else 618 { 619 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 620 { 621 if(f[tim][i][j][k][l]>0) 622 { 623 switch(first[2]) 624 { 625 case 'i' : 626 { 627 double okay=0; 628 fup(q,aim,29) okay+=guess[Might[i]][q]; 629 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 630 if(second[2]=='i') 631 { 632 fup(r,0,(num<<1)) 633 { 634 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 635 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 636 } 637 } 638 else if(second[2]=='p') 639 { 640 fup(r,0,(num<<1)) 641 { 642 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 643 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 644 } 645 } 646 else if(second[2]=='a') 647 { 648 fup(r,0,(num<<1)) 649 { 650 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 651 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 652 } 653 } 654 else 655 { 656 fup(r,0,(num<<1)) 657 { 658 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 659 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 660 } 661 } 662 break; 663 } 664 case 'p' : 665 { 666 double okay=0; 667 fup(q,aim,29) okay+=guess[Speed[j]][q]; 668 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 669 if(second[2]=='i') 670 { 671 fup(r,0,(num<<1)) 672 { 673 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 674 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 675 } 676 } 677 else if(second[2]=='p') 678 { 679 fup(r,0,(num<<1)) 680 { 681 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 682 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 683 } 684 } 685 else if(second[2]=='a') 686 { 687 fup(r,0,(num<<1)) 688 { 689 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 690 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 691 } 692 } 693 else 694 { 695 fup(r,0,(num<<1)) 696 { 697 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 698 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 699 } 700 } 701 break; 702 } 703 case 'a' : 704 { 705 double okay=0; 706 fup(q,aim,29) okay+=guess[Sanity[k]][q]; 707 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 708 if(second[2]=='i') 709 { 710 fup(r,0,(num<<1)) 711 { 712 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 713 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 714 } 715 } 716 else if(second[2]=='p') 717 { 718 fup(r,0,(num<<1)) 719 { 720 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 721 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 722 } 723 } 724 else if(second[2]=='a') 725 { 726 fup(r,0,(num<<1)) 727 { 728 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 729 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 730 } 731 } 732 else 733 { 734 fup(r,0,(num<<1)) 735 { 736 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 737 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 738 } 739 } 740 break; 741 } 742 case 'n' : 743 { 744 double okay=0; 745 fup(q,aim,29) okay+=guess[Knowledge[l]][q]; 746 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 747 if(second[2]=='i') 748 { 749 fup(r,0,(num<<1)) 750 { 751 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 752 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 753 } 754 } 755 else if(second[2]=='p') 756 { 757 fup(r,0,(num<<1)) 758 { 759 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 760 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 761 } 762 } 763 else if(second[2]=='a') 764 { 765 fup(r,0,(num<<1)) 766 { 767 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 768 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 769 } 770 } 771 else 772 { 773 fup(r,0,(num<<1)) 774 { 775 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 776 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 777 } 778 } 779 break; 780 } 781 } 782 } 783 } 784 } 785 } 786 } 787 else 788 { 789 re bool flag=1; 790 re char now=getchar(); 791 if(now=='=') flag=0; 792 re int aim=read()-flag; 793 scanf("%s",second+1); 794 now=getchar(); 795 while(now==' ') now=getchar(); 796 re int num=getchar()^48; 797 if(now=='+') 798 { 799 now=getchar(); 800 if(now!='?') 801 { 802 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 803 { 804 if(f[tim][i][j][k][l]>0) 805 { 806 switch(first[2]) 807 { 808 case 'i' : 809 { 810 double okay=0; 811 fup(q,0,aim) okay+=guess[Might[i]][q]; 812 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 813 if(second[2]=='i') 814 { 815 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 816 } 817 else if(second[2]=='p') 818 { 819 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 820 } 821 else if(second[2]=='a') 822 { 823 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 824 } 825 else 826 { 827 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 828 } 829 break; 830 } 831 case 'p' : 832 { 833 double okay=0; 834 fup(q,0,aim) okay+=guess[Speed[j]][q]; 835 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 836 if(second[2]=='i') 837 { 838 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 839 } 840 else if(second[2]=='p') 841 { 842 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 843 } 844 else if(second[2]=='a') 845 { 846 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 847 } 848 else 849 { 850 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 851 } 852 break; 853 } 854 case 'a' : 855 { 856 double okay=0; 857 fup(q,0,aim) okay+=guess[Sanity[k]][q]; 858 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 859 if(second[2]=='i') 860 { 861 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 862 } 863 else if(second[2]=='p') 864 { 865 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 866 } 867 else if(second[2]=='a') 868 { 869 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 870 } 871 else 872 { 873 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 874 } 875 break; 876 } 877 case 'n' : 878 { 879 double okay=0; 880 fup(q,0,aim) okay+=guess[Knowledge[l]][q]; 881 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 882 if(second[2]=='i') 883 { 884 f[tim+1][min(i+num,8)][j][k][l]+=f[tim][i][j][k][l]*okay; 885 } 886 else if(second[2]=='p') 887 { 888 f[tim+1][i][min(j+num,8)][k][l]+=f[tim][i][j][k][l]*okay; 889 } 890 else if(second[2]=='a') 891 { 892 f[tim+1][i][j][min(k+num,8)][l]+=f[tim][i][j][k][l]*okay; 893 } 894 else 895 { 896 f[tim+1][i][j][k][min(l+num,8)]+=f[tim][i][j][k][l]*okay; 897 } 898 break; 899 } 900 } 901 } 902 } 903 } 904 else 905 { 906 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 907 { 908 if(f[tim][i][j][k][l]>0) 909 { 910 switch(first[2]) 911 { 912 case 'i' : 913 { 914 double okay=0; 915 fup(q,0,aim) okay+=guess[Might[i]][q]; 916 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 917 if(second[2]=='i') 918 { 919 fup(r,0,(num<<1)) 920 { 921 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 922 } 923 } 924 else if(second[2]=='p') 925 { 926 fup(r,0,(num<<1)) 927 { 928 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 929 } 930 } 931 else if(second[2]=='a') 932 { 933 fup(r,0,(num<<1)) 934 { 935 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 936 } 937 } 938 else 939 { 940 fup(r,0,(num<<1)) 941 { 942 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 943 } 944 } 945 break; 946 } 947 case 'p' : 948 { 949 double okay=0; 950 fup(q,0,aim) okay+=guess[Speed[j]][q]; 951 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 952 if(second[2]=='i') 953 { 954 fup(r,0,(num<<1)) 955 { 956 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 957 } 958 } 959 else if(second[2]=='p') 960 { 961 fup(r,0,(num<<1)) 962 { 963 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 964 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*okay*(1-guess[num][r]); 965 } 966 } 967 else if(second[2]=='a') 968 { 969 fup(r,0,(num<<1)) 970 { 971 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 972 } 973 } 974 else 975 { 976 fup(r,0,(num<<1)) 977 { 978 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 979 } 980 } 981 break; 982 } 983 case 'a' : 984 { 985 double okay=0; 986 fup(q,0,aim) okay+=guess[Sanity[k]][q]; 987 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 988 if(second[2]=='i') 989 { 990 fup(r,0,(num<<1)) 991 { 992 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 993 } 994 } 995 else if(second[2]=='p') 996 { 997 fup(r,0,(num<<1)) 998 { 999 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1000 } 1001 } 1002 else if(second[2]=='a') 1003 { 1004 fup(r,0,(num<<1)) 1005 { 1006 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1007 } 1008 } 1009 else 1010 { 1011 fup(r,0,(num<<1)) 1012 { 1013 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1014 } 1015 } 1016 break; 1017 } 1018 case 'n' : 1019 { 1020 double okay=0; 1021 fup(q,0,aim) okay+=guess[Knowledge[l]][q]; 1022 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1023 if(second[2]=='i') 1024 { 1025 fup(r,0,(num<<1)) 1026 { 1027 f[tim+1][min(i+r,8)][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1028 } 1029 } 1030 else if(second[2]=='p') 1031 { 1032 fup(r,0,(num<<1)) 1033 { 1034 f[tim+1][i][min(j+r,8)][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1035 } 1036 } 1037 else if(second[2]=='a') 1038 { 1039 fup(r,0,(num<<1)) 1040 { 1041 f[tim+1][i][j][min(k+r,8)][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1042 } 1043 } 1044 else 1045 { 1046 fup(r,0,(num<<1)) 1047 { 1048 f[tim+1][i][j][k][min(l+r,8)]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1049 } 1050 } 1051 break; 1052 } 1053 } 1054 } 1055 } 1056 } 1057 } 1058 else 1059 { 1060 now=getchar(); 1061 if(now!='?') 1062 { 1063 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 1064 { 1065 if(f[tim][i][j][k][l]>0) 1066 { 1067 switch(first[2]) 1068 { 1069 case 'i' : 1070 { 1071 double okay=0; 1072 fup(q,0,aim) okay+=guess[Might[i]][q]; 1073 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1074 if(second[2]=='i') 1075 { 1076 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 1077 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 1078 } 1079 else if(second[2]=='p') 1080 { 1081 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 1082 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 1083 } 1084 else if(second[2]=='a') 1085 { 1086 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 1087 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 1088 } 1089 else 1090 { 1091 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 1092 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 1093 } 1094 break; 1095 } 1096 case 'p' : 1097 { 1098 double okay=0; 1099 fup(q,0,aim) okay+=guess[Speed[j]][q]; 1100 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1101 if(second[2]=='i') 1102 { 1103 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 1104 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 1105 } 1106 else if(second[2]=='p') 1107 { 1108 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 1109 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 1110 } 1111 else if(second[2]=='a') 1112 { 1113 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 1114 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 1115 } 1116 else 1117 { 1118 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 1119 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 1120 } 1121 break; 1122 } 1123 case 'a' : 1124 { 1125 double okay=0; 1126 fup(q,0,aim) okay+=guess[Sanity[k]][q]; 1127 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1128 if(second[2]=='i') 1129 { 1130 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 1131 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 1132 } 1133 else if(second[2]=='p') 1134 { 1135 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 1136 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 1137 } 1138 else if(second[2]=='a') 1139 { 1140 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 1141 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 1142 } 1143 else 1144 { 1145 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 1146 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 1147 } 1148 break; 1149 } 1150 case 'n' : 1151 { 1152 double okay=0; 1153 fup(q,0,aim) okay+=guess[Knowledge[l]][q]; 1154 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1155 if(second[2]=='i') 1156 { 1157 if(i-num<=0) dead+=f[tim][i][j][k][l]*okay; 1158 else f[tim+1][i-num][j][k][l]+=f[tim][i][j][k][l]*okay; 1159 } 1160 else if(second[2]=='p') 1161 { 1162 if(j-num<=0) dead+=f[tim][i][j][k][l]*okay; 1163 else f[tim+1][i][j-num][k][l]+=f[tim][i][j][k][l]*okay; 1164 } 1165 else if(second[2]=='a') 1166 { 1167 if(k-num<=0) dead+=f[tim][i][j][k][l]*okay; 1168 else f[tim+1][i][j][k-num][l]+=f[tim][i][j][k][l]*okay; 1169 } 1170 else 1171 { 1172 if(l-num<=0) dead+=f[tim][i][j][k][l]*okay; 1173 else f[tim+1][i][j][k][l-num]+=f[tim][i][j][k][l]*okay; 1174 } 1175 break; 1176 } 1177 } 1178 } 1179 } 1180 } 1181 else 1182 { 1183 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) 1184 { 1185 if(f[tim][i][j][k][l]>0) 1186 { 1187 switch(first[2]) 1188 { 1189 case 'i' : 1190 { 1191 double okay=0; 1192 fup(q,0,aim) okay+=guess[Might[i]][q]; 1193 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1194 if(second[2]=='i') 1195 { 1196 fup(r,0,(num<<1)) 1197 { 1198 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1199 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1200 } 1201 } 1202 else if(second[2]=='p') 1203 { 1204 fup(r,0,(num<<1)) 1205 { 1206 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1207 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1208 } 1209 } 1210 else if(second[2]=='a') 1211 { 1212 fup(r,0,(num<<1)) 1213 { 1214 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1215 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1216 } 1217 } 1218 else 1219 { 1220 fup(r,0,(num<<1)) 1221 { 1222 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1223 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1224 } 1225 } 1226 break; 1227 } 1228 case 'p' : 1229 { 1230 double okay=0; 1231 fup(q,0,aim) okay+=guess[Speed[j]][q]; 1232 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1233 if(second[2]=='i') 1234 { 1235 fup(r,0,(num<<1)) 1236 { 1237 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1238 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1239 } 1240 } 1241 else if(second[2]=='p') 1242 { 1243 fup(r,0,(num<<1)) 1244 { 1245 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1246 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1247 } 1248 } 1249 else if(second[2]=='a') 1250 { 1251 fup(r,0,(num<<1)) 1252 { 1253 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1254 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1255 } 1256 } 1257 else 1258 { 1259 fup(r,0,(num<<1)) 1260 { 1261 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1262 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1263 } 1264 } 1265 break; 1266 } 1267 case 'a' : 1268 { 1269 double okay=0; 1270 fup(q,0,aim) okay+=guess[Sanity[k]][q]; 1271 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1272 if(second[2]=='i') 1273 { 1274 fup(r,0,(num<<1)) 1275 { 1276 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1277 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1278 } 1279 } 1280 else if(second[2]=='p') 1281 { 1282 fup(r,0,(num<<1)) 1283 { 1284 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1285 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1286 } 1287 } 1288 else if(second[2]=='a') 1289 { 1290 fup(r,0,(num<<1)) 1291 { 1292 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1293 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1294 } 1295 } 1296 else 1297 { 1298 fup(r,0,(num<<1)) 1299 { 1300 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1301 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1302 } 1303 } 1304 break; 1305 } 1306 case 'n' : 1307 { 1308 double okay=0; 1309 fup(q,0,aim) okay+=guess[Knowledge[l]][q]; 1310 f[tim+1][i][j][k][l]+=f[tim][i][j][k][l]*(1-okay); 1311 if(second[2]=='i') 1312 { 1313 fup(r,0,(num<<1)) 1314 { 1315 if(i-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1316 else f[tim+1][i-r][j][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1317 } 1318 } 1319 else if(second[2]=='p') 1320 { 1321 fup(r,0,(num<<1)) 1322 { 1323 if(j-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1324 else f[tim+1][i][j-r][k][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1325 } 1326 } 1327 else if(second[2]=='a') 1328 { 1329 fup(r,0,(num<<1)) 1330 { 1331 if(k-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1332 else f[tim+1][i][j][k-r][l]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1333 } 1334 } 1335 else 1336 { 1337 fup(r,0,(num<<1)) 1338 { 1339 if(l-r<=0) dead+=f[tim][i][j][k][l]*okay*guess[num][r]; 1340 else f[tim+1][i][j][k][l-r]+=f[tim][i][j][k][l]*okay*guess[num][r]; 1341 } 1342 } 1343 break; 1344 } 1345 } 1346 } 1347 } 1348 } 1349 } 1350 } 1351 } 1352 fup(i,1,8) fup(j,1,8) fup(k,1,8) fup(l,1,8) if(f[i][j][k][l]>0) { 1353 ed[0][Might[i]]+=f[n][i][j][k][l],ed[1][Speed[j]]+=f[n][i][j][k][l]; 1354 ed[2][Sanity[k]]+=f[n][i][j][k][l],ed[3][Knowledge[l]]+=f[n][i][j][k][l]; 1355 1356 } 1357 printf("%.2Lf ",dead); 1358 fup(tim,0,3) 1359 { 1360 fup(d,1,8) 1361 { 1362 printf("%.2Lf ",ed[tim][d]); 1363 } 1364 puts(""); 1365 } 1366 }
C. 彩球问题
主要是考场一点都没看这个题感觉自己很失败。
题解说的挺明白了。
就咕咕咕吧。(反正我任务完成了hhh
我曾经来过。
我每日朝歌。
辜负生活,不辜负野心。
加油吧,离开也要精彩。
“没关系,都一样的。”