結果
| 問題 |
No.1007 コイン集め
|
| コンテスト | |
| ユーザー |
ate
|
| 提出日時 | 2020-07-08 22:26:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 341 bytes |
| コンパイル時間 | 626 ms |
| コンパイル使用メモリ | 71,976 KB |
| 最終ジャッジ日時 | 2025-01-11 17:03:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 4 |
ソースコード
#include<iostream>
#include<vector>
signed main(){
int n,k;
std::cin>>n>>k;
k--;
std::vector<int> a(n);
for(auto& ai:a)std::cin>>ai;
int l=k,r=k;
while(l>0){
if(a[l]<=1)break;
l--;
}
while(r<n){
if(a[r]<=1)break;
r++;
}
int64_t ans = 0;
for(int i=l;i<=r;++i)ans+=a[i];
std::cout<< ans <<std::endl;
}
ate