Submission #00127


ソースコード

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
#include<bits/stdc++.h>
#define np(v) next_permutation(v.begin(),v.end()) //次の順列
#define gcd(a,b) __gcd(a,b) //最大公約数
#define lcm(a,b) a/(gcd(a,b))*b //最小公倍数
#define lb(v,a) lower_bound(v.begin(),v.end(),a) //以上の最初
#define ub(v,a) upper_bound(v.begin(),v.end(),a) //越えの最初
#define bs(v,a) binary_search(v.begin(),v.end(),a) //値があるか
#define fixed(a) fixed<<setprecision(a) //小数点以下第 a + 1 を四捨五入
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll,int>;
using pq = priority_queue<P,vector<P>,greater<P>>;
const int inf = 1 << 30;
const ll ll_inf = 1LL << 62;
struct edge {
int c,to;
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
srand((unsigned int)time(NULL));
int N;
while(cin>>N){
if(N == 0) break;
int ans,x = inf;
for(int i = 0;i < N;i++){
int a;
cin>>a;
if(abs(a - 2023) < x) ans = i + 1,x = abs(a - 2023);
}
cout<<ans<<"\n";
}
}

ステータス

項目 データ
問題 0006 - スポンサー賞はどのチーム?
ユーザー名 r2213
投稿日時 2024-03-29 12:24:22
言語 C++17
状態 Accepted
得点 20
ソースコード長 1106 Byte
最大実行時間 26 ms
最大メモリ使用量 636 KB

セット

セット 得点 Cases
1 ALL 20 / 20 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
A1 AC 20 ms 476 KB
1
A2 AC 25 ms 560 KB
1
A3 AC 21 ms 636 KB
1
A4 AC 26 ms 592 KB
1