Submission #00201
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <bits/stdc++.h> using namespace std; #define endl "\n" #define rep(i, a, b) for(int i = a; i < b; i++) #define rrep(i, a, b) for(int i = a; i >= b; i--) #define all(x) (x).begin(),(x).end() #define inf 1001001001 template < class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true ;} return false ; } template < class T> bool chmin(T &a, const T &b) { if (b < a) {a = b; return true ;} return false ; } //================================================================================================ int main(){ int n, ans = inf, place; cin >> n; while (n != 0){ int time , judge[n]; ans = inf; for ( int i = 0; i < n; i++){ cin >> time ; judge[i] = abs (2023 - time ); if (ans > judge[i]){ place = i + 1; ans = judge[i]; } } cout << place << endl; cin >> n; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - スポンサー賞はどのチーム? |
ユーザー名 | ei2212 |
投稿日時 | 2024-03-29 13:30:10 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 959 Byte |
最大実行時間 | 24 ms |
最大メモリ使用量 | 640 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 24 ms | 604 KB |
1
|
A2 | AC | 18 ms | 580 KB |
1
|
A3 | AC | 21 ms | 548 KB |
1
|
A4 | AC | 21 ms | 640 KB |
1
|