結果
| 問題 |
No.1007 コイン集め
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-22 09:41:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 421 bytes |
| コンパイル時間 | 1,419 ms |
| コンパイル使用メモリ | 167,676 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 00:45:21 |
| 合計ジャッジ時間 | 2,529 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 10 WA * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
long a[n+2];
a[0] = 0;
for(int i=1;i<=n;i++)cin >> a[i];
a[n+1] = 0;
long ans = 0;
int usi = k;
while(a[usi-1]>0)usi--;
while(usi<k){
ans += a[usi];
usi++;
}
while(a[usi+1]>0)usi++;
while(usi>=k){
ans+= a[usi];
usi--;
}
printf("%ld\n",ans);
}