結果
| 問題 |
No.884 Eat and Add
|
| コンテスト | |
| ユーザー |
llllltwwwww
|
| 提出日時 | 2019-09-13 22:56:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 1,000 ms |
| コード長 | 681 bytes |
| コンパイル時間 | 506 ms |
| コンパイル使用メモリ | 67,968 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 10:14:40 |
| 合計ジャッジ時間 | 1,132 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<cmath>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;
int main(){
ll ans=0;
int count=0;
string s;
cin>>s;
for(int i=0;i<3;i++)s.push_back('0');
for(int i=0;i<(int)s.size();i++){
if(s[i]=='1') count++;
else{
if(count==1) ans++;
else if(count==0) ;
else if(s[i+1]=='1'){
ans++;
count++;
continue;
}else ans+=2;
count=0;
}
//cout<<i<<" "<<ans<<endl;
}
cout<<ans<<endl;
}
llllltwwwww