結果
問題 | No.21 平均の差 |
ユーザー | youjo_yamioti |
提出日時 | 2018-11-30 14:34:16 |
言語 | C++11 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 939 ms |
コンパイル使用メモリ | 25,256 KB |
実行使用メモリ | 4,508 KB |
最終ジャッジ日時 | 2023-09-09 06:28:14 |
合計ジャッジ時間 | 3,374 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:10: warning: ‘N’ is used uninitialized in this function [-Wuninitialized] scanf("%d %d",N,K); ~~~~~^~~~~~~~~~~~~ main.cpp:26:10: warning: ‘K’ is used uninitialized in this function [-Wuninitialized]
ソースコード
#include<cstdio> using namespace std; int max(int a[]){ int M=0; int *p = a; while(*p != 0){ if(*p > M) M = *p; p++; } return M; } int min(int a[]){ int m=1000000; int *p = a; while(*p != 0){ if(*p < m) m = *p; p++; } 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); m = min(array); printf("%d\n",M-m); return 0; }