結果
| 問題 |
No.1007 コイン集め
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-07 00:19:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 284 bytes |
| コンパイル時間 | 546 ms |
| コンパイル使用メモリ | 63,360 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 10:19:39 |
| 合計ジャッジ時間 | 1,825 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 4 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N,K;
long A[2<<17];
main()
{
cin>>N>>K;
for(int i=0;i<N;i++)cin>>A[i];
long ans=0;
K--;
for(int i=K;i>=0;i--)
{
ans+=A[i];
if(A[i]<=1)break;
}
for(int i=K;i<N;i++)
{
ans+=A[i];
if(A[i]<=1)break;
}
cout<<ans-A[K]<<endl;
}