結果
問題 | No.394 ハーフパイプ(1) |
ユーザー | ぱ |
提出日時 | 2017-06-19 17:57:36 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 317 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-10 06:06:41 |
合計ジャッジ時間 | 814 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:25:19: warning: unknown conversion type character ‘0’ in format [-Wformat=] 25 | printf("%l0.2f\n",x/4); | ^ main.cpp:25:16: warning: too many arguments for format [-Wformat-extra-args] 25 | printf("%l0.2f\n",x/4); | ^~~~~~~~~~ main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&p[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:13:38: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations] 13 | if(p[i]>p[i+1]){ | ~~~~~^ main.cpp:12:26: note: within this loop 12 | for(i=0;i<5;i++){ | ~^~ main.cpp:23:18: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 23 | x+=p[i]; | ~^~~~~~
ソースコード
#include<stdio.h> int main() { double x; int i,j,s,p[5]; for(i=0;i<6;i++){ scanf("%d",&p[i]); } do{s=0; for(i=0;i<5;i++){ if(p[i]>p[i+1]){ p[i]^=p[i+1]; p[i+1]^=p[i]; p[i]^=p[i+1]; s=1; } } }while(s!=0); for(i=1;i<5;i++){ x+=p[i]; } printf("%l0.2f\n",x/4); return 0; }