結果

問題 No.21 平均の差
ユーザー youjo_yamiotiyoujo_yamioti
提出日時 2018-11-30 14:44:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 25,732 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 06:28:26
合計ジャッジ時間 833 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
using namespace std;
int max(int* a,int num){
    int M=0;
    int i;
    for(i=0;i<num;i++){
        if(a[i]>M) M=a[i];
    }
    return M;
}
int min(int* a,int num){
    int m=100000;
    int i;
    for(i=0;i<num;i++){
        if(a[i]<m) m=a[i];
    }
    return m;
}
int main(){
    int N,K;
    int array[9];
    int i;
    int M,m;
    scanf("%d %d",&N,&K);
    for(i = 0;i < N;i++){
        scanf("%d",&array[i]);
    }
    M = max(array,N);
    m = min(array,N);
    printf("%d\n",M-m);
    return 0;
}
0