結果

問題 No.3163 [Cherry 7th Tune N] Draft
ユーザー hex4448
提出日時 2025-06-01 23:22:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 28,416 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-01 23:22:03
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%ld %ld %ld %ld %ld", &abcde[i][0], &abcde[i][1], &abcde[i][2], &abcde[i][3], &abcde[i][4]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
    int t;

    scanf("%d", &t);
    long int abcde[t][5];
    long int num[t];

    for (int i = 0; i < t; i++)
    {
        scanf("%ld %ld %ld %ld %ld", &abcde[i][0], &abcde[i][1], &abcde[i][2], &abcde[i][3], &abcde[i][4]);
        int max = 0;
        int min = 0;  
        for (int j = 1; j < 5; j++){
            if (abcde[i][max] < abcde[i][j]){
                max = j;                
            }
            if (abcde[i][min] > abcde[i][j]){
                min = j;
            }
            
        }
        num[i] = abcde[i][max] - abcde[i][min];
    }
    for (int i = 0; i < t; i++)
    {
        printf("%ld\n", num[i]);
    }
    return 0;
}
0