結果

問題 No.966 引き算をして門松列(その1)
ユーザー courange_coucourange_cou
提出日時 2020-01-13 21:53:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,545 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-02 06:16:25
合計ジャッジ時間 605 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:47:15: warning: 'A' may be used uninitialized [-Wmaybe-uninitialized]
   47 |          a[i] = A;
      |          ~~~~~^~~
main.cpp:4:8: note: 'A' was declared here
    4 |    int A,B,C;
      |        ^
main.cpp:48:15: warning: 'B' may be used uninitialized [-Wmaybe-uninitialized]
   48 |          b[i] = B;
      |          ~~~~~^~~
main.cpp:4:10: note: 'B' was declared here
    4 |    int A,B,C;
      |          ^
main.cpp:49:15: warning: 'C' may be used uninitialized [-Wmaybe-uninitialized]
   49 |          c[i] = C;
      |          ~~~~~^~~
main.cpp:4:12: note: 'C' was declared here
    4 |    int A,B,C;
      |            ^

ソースコード

diff #

#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]))){
         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]);
   }
}
0