結果
問題 | No.29 パワーアップ |
ユーザー | yn |
提出日時 | 2014-11-25 18:48:08 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 578 bytes |
コンパイル時間 | 545 ms |
コンパイル使用メモリ | 26,380 KB |
実行使用メモリ | 4,504 KB |
最終ジャッジ日時 | 2023-08-31 01:11:59 |
合計ジャッジ時間 | 1,189 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:8: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations] up[i]=0; ~~~~~^~ main.cpp:16:11: note: within this loop for(i=0;i<=11;i++){ ~^~~~ main.cpp:42:15: warning: iteration 10 invokes undefined behavior [-Waggressive-loop-optimizations] pup=pup+up[i]/2; ~~~~^ main.cpp:41:11: note: within this loop for(i=1;i<=11;i++){ ~^~~~
ソースコード
#include<stdio.h> int main(){ int N=0,M=0; int i=0,j=0; int pup=0; int a[301]; int l[11]; int up[11]; int sp=0; scanf("%d",&N); M=N*3; for(i=0;i<=11;i++){ a[i]=0; up[i]=0; } for(i=0;i<M;i++){ scanf("%d",&a[i]); } for(i=1;i<=10;i++){ for(j=0;j<M;j++){ if(a[j]==i){ l[i]=l[i]+1; } } } for(i=0;i<=11;i++){ for(j=1;j<M;j++){ if(a[j]==i){ up[i]=up[i]+1; } } } for(i=1;i<=11;i++){ pup=pup+up[i]/2; sp=sp+up[i]%2; } pup=pup+sp/4; printf("%d¥n",pup); return 0; }