結果
問題 | No.966 引き算をして門松列(その1) |
ユーザー | courange_cou |
提出日時 | 2020-01-13 21:51:39 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,623 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 32,000 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-02 06:12:53 |
合計ジャッジ時間 | 673 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:49:15: warning: 'A' may be used uninitialized [-Wmaybe-uninitialized] 49 | a[i] = A; | ~~~~~^~~ main.cpp:4:8: note: 'A' was declared here 4 | int A,B,C; | ^ main.cpp:50:15: warning: 'B' may be used uninitialized [-Wmaybe-uninitialized] 50 | b[i] = B; | ~~~~~^~~ main.cpp:4:10: note: 'B' was declared here 4 | int A,B,C; | ^ main.cpp:51:15: warning: 'C' may be used uninitialized [-Wmaybe-uninitialized] 51 | c[i] = C; | ~~~~~^~~ main.cpp:4:12: note: 'C' was declared here 4 | int A,B,C; | ^
ソースコード
#include <stdio.h> int main(){ int n,a[10000],b[10000],c[10000],ans[10000],x; int A,B,C; scanf("%d\n",&n); for(int i = 0;i < n;i++){ scanf("%d %d %d",&a[i],&b[i],&c[i]); } for(int i = 0;i < n;i++){ if( ((b[i] > a[i])&&(b[i] > c[i])&&(a[i] != b[i])&&(a[i] != c[i]))|| ((c[i] > a[i])&&(c[i] > b[i])&&(a[i] != c[i])&&(a[i] != b[i]))){ ans[i] = 0; //printf("flag:A\n"); }else if(a[i] + b[i] + c[i] <= 6){ ans[i] = -1; //printf("flag:B\n"); }else if((a[i] == b[i])&&(a[i] == c[i])){ ans[i] = 3; //printf("flag:C\n"); }else { if((a[i] < b[i])&&(b[i] > c[i])){ x = c[i]; c[i] = b[i]; b[i] = x; }else if((b[i] > a[i])&&(a[i] > c[i])){ x = a[i]; a[i] = b[i]; b[i] = x; }else if((b[i] > c[i])&&(c[i] > a[i])){ x = a[i]; a[i] = b[i]; b[i] = x; x = c[i]; c[i] = b[i]; b[i] = x; }else if((c[i] > a[i])&&(a[i] > b[i])){ x = a[i]; a[i] = c[i]; c[i] = x; x = c[i]; c[i] = b[i]; b[i] = x; }else if((c[i] > b[i])&&(b[i] > a[i])){ x = a[i]; a[i] = c[i]; c[i] = x; } a[i] = A; b[i] = B; c[i] = C; ans[i] = A-C; if(A-C == C)ans[i]++; if(ans[i] > A-B)ans[i] == A-B; if(A-B == B)ans[i]++; //printf("flag:D\n"); } printf("%d\n",ans[i]); } }