結果
問題 |
No.21 平均の差
|
ユーザー |
![]() |
提出日時 | 2015-07-26 20:28:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 355 bytes |
コンパイル時間 | 1,294 ms |
コンパイル使用メモリ | 159,324 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 14:16:12 |
合計ジャッジ時間 | 1,800 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘void input()’: main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d%d", &n, &k); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:16:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | rep(i,n) scanf("%d", a+i); | ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repi(i,0,n) int n, k, a[10]; int solve() { sort(a,a+n); return a[n-1]-a[0]; } void input() { scanf("%d%d", &n, &k); rep(i,n) scanf("%d", a+i); } int main() { input(); printf("%d\n", solve()); return 0; }