結果
問題 |
No.3163 [Cherry 7th Tune N] Draft
|
ユーザー |
![]() |
提出日時 | 2025-05-30 22:46:04 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 603 ms |
コンパイル使用メモリ | 26,960 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-30 22:46:11 |
合計ジャッジ時間 | 1,569 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘solve’: main.c:20:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d", &a[i]); | ^~~~~~~~~~~~~~~~~~ main.c: In function ‘main’: main.c:33:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | scanf("%d", &t); | ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a < b) return a; else return b; } void solve() { int n = 5, a[5], i; for (i = 0; i < n; i++) scanf("%d", &a[i]); int r = -1, l = 2e9; for (i = 0; i < n; i++) { l = min(l, a[i]); r = max(r, a[i]); } printf("%d\n", r - l); return; } int main() { int t; scanf("%d", &t); for (; t > 0; t--) solve(); return 0; }