Submission #00030
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int main(){ int n,m; int a[1000]; while (1){ int max = -1; cin >> n >> m; if (n==0 && m==0) break ; for ( int i=0;i<n;i++){ cin >> a[i]; } for ( int i=0;i<n-1;i++){ for ( int j=i+1;j<n;j++){ int sum=a[i]+a[j]; if (sum>max && sum<=m) max=sum; } } if (max == -1) cout << "NONE" << endl; else cout << max << endl; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - 太郎君の買物 |
ユーザー名 | P_ei1623 |
投稿日時 | 2018-03-30 13:11:34 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 462 Byte |
最大実行時間 | 38 ms |
最大メモリ使用量 | 528 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 38 ms | 480 KB |
1
|
A2 | AC | 31 ms | 452 KB |
1
|
A3 | AC | 35 ms | 424 KB |
1
|
A4 | AC | 28 ms | 528 KB |
1
|