結果
問題 | No.5003 物理好きクリッカー |
ユーザー | tails |
提出日時 | 2018-12-04 19:44:58 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 339 ms / 10,000 ms |
コード長 | 3,213 bytes |
コンパイル時間 | 268 ms |
実行使用メモリ | 21,996 KB |
スコア | 312,735,397,303 |
平均クエリ数 | 10000.00 |
最終ジャッジ日時 | 2021-07-19 08:29:23 |
合計ジャッジ時間 | 13,725 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 309 ms
21,384 KB |
testcase_01 | AC | 339 ms
21,840 KB |
testcase_02 | AC | 303 ms
21,840 KB |
testcase_03 | AC | 307 ms
21,840 KB |
testcase_04 | AC | 309 ms
21,336 KB |
testcase_05 | AC | 313 ms
21,888 KB |
testcase_06 | AC | 311 ms
21,372 KB |
testcase_07 | AC | 319 ms
21,612 KB |
testcase_08 | AC | 306 ms
21,540 KB |
testcase_09 | AC | 311 ms
21,828 KB |
testcase_10 | AC | 314 ms
21,840 KB |
testcase_11 | AC | 314 ms
21,480 KB |
testcase_12 | AC | 316 ms
21,360 KB |
testcase_13 | AC | 338 ms
21,780 KB |
testcase_14 | AC | 309 ms
21,864 KB |
testcase_15 | AC | 331 ms
21,876 KB |
testcase_16 | AC | 306 ms
21,552 KB |
testcase_17 | AC | 338 ms
21,864 KB |
testcase_18 | AC | 309 ms
21,384 KB |
testcase_19 | AC | 305 ms
21,516 KB |
testcase_20 | AC | 302 ms
21,852 KB |
testcase_21 | AC | 319 ms
21,792 KB |
testcase_22 | AC | 311 ms
21,828 KB |
testcase_23 | AC | 328 ms
21,360 KB |
testcase_24 | AC | 317 ms
21,684 KB |
testcase_25 | AC | 319 ms
21,840 KB |
testcase_26 | AC | 318 ms
21,840 KB |
testcase_27 | AC | 315 ms
21,828 KB |
testcase_28 | AC | 310 ms
21,420 KB |
testcase_29 | AC | 333 ms
21,828 KB |
testcase_30 | AC | 312 ms
21,720 KB |
testcase_31 | AC | 316 ms
21,336 KB |
コンパイルメッセージ
main.c:29:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int] 29 | main(){ | ^~~~ main.c: 関数 ‘main’ 内: main.c:30:2: 警告: 関数 ‘gets’ の暗黙的な宣言です [-Wimplicit-function-declaration] 30 | gets(buf); | ^~~~ main.c:67:6: 警告: 関数 ‘dprintf’ の暗黙的な宣言です [-Wimplicit-function-declaration] 67 | dprintf(1,"sell %s\n",fnames[i]); | ^~~~~~~ /tmp/ccw0y2qm.o: In function `main': main.c:(.text.startup+0x16): warning: the `gets' function is dangerous and should not be used.
ソースコード
char const* fnames[]={"hand","lily","factory","casino","grimoire"}; long bspeeds[]={1,10,120,2000,25000}; long bprices[]={150,2000,30000,600000,10000000}; char acts[]="AABBBBBBCBBDDBDDDBDAEDDFDFFFBDBBFFGFFCHDBBHBBHFHDHHIHHFJHJHJFEDDJFDDDJBBJKJGHFFJJFJFHFHDDBIHHJHJFHFDBBHJJJCDBBBBAKJJJHHEFJDDDFDDHGFFFFDBBJHFDBIHHHJHFHFBJDBKJJJJDHFBJCBBBBDHFBJDHFEDDDDBJDHFABGFFFFJDHFBIHHHHJDHFBJDKJJJJHFBJDHFBJCBBBBDHFBJDHFEDDDDBJDHFBGFFFFJDHFBIHHHHJADHFBJDKJJJJHFBJDHFBJDHFCBBBBBJDHF"; char events[10010]; char buf[100]; int asale[10010]; int akoma[10010]; int abonus[10010]; long buy_price(long base,int num){ long price=base; for(;num--;){ price=(price*6+4)/5; } return price; } long rein_price(long base,int lvl){ long price=base; for(;lvl--;){ price*=10; } return price; } main(){ gets(buf); gets(events); { int koma=0; int fever=0; int nextsale=20000; for(int turn=10000;turn--;){ if(events[turn]=='S'){ nextsale=turn; } asale[turn]=nextsale; koma+=events[turn]=='F'?121:1; } for(int turn=0;turn<10000;++turn){ akoma[turn]=koma; koma-=fever?(--fever,7):1; if(events[turn]=='F'){ fever=20; } } } long cookie=0; int cl=0; int n[5]={0,0,0,0,0}; int l[5]={0,0,0,0,0}; int nsum=0; int nowsale=0; int nowfever=0; char* pa=acts; for(int turn=0;turn<10000;++turn){ // action if(turn+nsum>=10000){ for(int i=0;i<5;++i){ if(n[i]){ n[i]-=1; cookie+=buy_price(bprices[i],n[i])/4; dprintf(1,"sell %s\n",fnames[i]); break; } } }else{ int done=0; int a=*pa; if(a=='A'){ // enhclick long price1=rein_price(15,cl); long price2=price1-price1/10; long price=nowsale?price2:price1; long delta=1ll<<cl; if(cookie>=price && delta*(asale[turn]-turn)>=price-price2 && akoma[turn]*delta>price ){ cookie-=price; cl+=1; done=1; dprintf(1,"enhclick\n"); } }else if(a>='B'&&a<='K'){ int i=a-'B'>>1; if(a&1){ // reinforce long price1=rein_price(bprices[i]*10,l[i]); long price2=price1-price1/10; long price=nowsale?price2:price1; long delta=bspeeds[i]*n[i]<<l[i]; if(cookie>=price && delta*(asale[turn]-turn)>=price-price2 && akoma[turn]*delta>price ){ cookie-=price; l[i]+=1; done=1; dprintf(1,"reinforce %s\n",fnames[i]); } }else{ // buy long price1=buy_price(bprices[i],n[i]); long price2=price1-price1/10; long price=nowsale?price2:price1; long delta=bspeeds[i]<<l[i]; if(cookie>=price && delta*(asale[turn]-turn)>=price-price2 && akoma[turn]*delta>price-price1/4 ){ cookie-=price; n[i]+=1; nsum+=1; done=1; dprintf(1,"buy %s\n",fnames[i]); } } } if(done){ ++pa; }else{ // click cookie+=(1ll<<cl)*(nowfever?7:1); dprintf(1,"click\n"); } } // response gets(buf); // produce for(int i=0;i<5;++i){ cookie+=(bspeeds[i]*n[i]<<l[i])*(nowfever?7:1); } // event if(nowfever){ --nowfever; } if(nowsale){ --nowsale; } if(events[turn]=='F'){ nowfever=20; } if(events[turn]=='S'){ nowsale=1; } if(events[turn]=='B'){ cookie+=(cookie+99)/100; } } }