結果
問題 | No.21 平均の差 |
ユーザー |
![]() |
提出日時 | 2015-12-29 00:27:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 244 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 33,864 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 08:15:32 |
合計ジャッジ時間 | 649 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int a,b;scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~ main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",c+i); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h> #include<algorithm> using namespace std; int c[10]; int main(){ int a,b;scanf("%d%d",&a,&b); int L=999999; int R=-999999; for(int i=0;i<a;i++){ scanf("%d",c+i); L=min(L,c[i]); R=max(R,c[i]); } printf("%d\n",R-L); }