Submission #00261
ソースコード
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <bits/stdc++.h> #define S << " " #define fin << "\n" #define rn long double #define SS << " " << #define nintendo switch #define lol long long int #define fout cout << "No\n" #define tout cout << "Yes\n" #define check cout << 1 fin; #define ins(i) if(i) cout << " " #define Iter(type) type::iterator #define usort(a) sort(a.begin() , a.end()) #define dsort(a) sort(a.rbegin() , a.rend()) #define fixout(a) cout << fixed << setprecision(a) #define push_pair(a , b) push_back(make_pair(a , b)) #define ub(a , b) upper_bound(a.begin() , a.end() , b) #define lb(a , b) lower_bound(a.begin() , a.end() , b) #define bs(a , b) binary_search(a.begin() , a.end() , b) #define dptable(n , m) vvec(lol , dp , n + 1 , m + 1 , 0) #define out_all(a , b) for(auto b = a.begin();b != a.end();b ++) cout << *b fin #define vvec(type , arr , n , m , def) vector<vector<type>> arr(n , vector<type> (m , def)) using namespace std; int main( void ){ ios::sync_with_stdio( false ); cin.tie(0); int n , ans , wa; cin >> n; while (n){ vector< int > a(n); for ( int i = 0;i < n;i ++) cin >> a[i]; ans = 0; wa = abs (a[0] - 2023); for ( int i = 1;i < n;i ++){ if ( abs (a[i] - 2023) < wa){ ans = i; wa = abs (a[i] - 2023); } } cout << ans + 1 fin; cin >> n; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - スポンサー賞はどのチーム? |
ユーザー名 | Koba_gochiusa |
投稿日時 | 2024-03-29 14:30:26 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 1429 Byte |
最大実行時間 | 28 ms |
最大メモリ使用量 | 688 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 15 ms | 604 KB |
1
|
A2 | AC | 20 ms | 688 KB |
1
|
A3 | AC | 22 ms | 644 KB |
1
|
A4 | AC | 28 ms | 468 KB |
1
|