結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
himo
|
| 提出日時 | 2019-09-17 17:56:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 1,059 ms |
| コンパイル使用メモリ | 158,296 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 13:19:45 |
| 合計ジャッジ時間 | 1,625 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 4 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main(){
string n;
cin >>n;
bool che =false;
int ans =0;
int anss =0;
for(int i=0;i<n.size();i++){
if(che){
if(n.at(i)=='3')ans++;
else{
if(n.at(i)=='1'){
anss =max(anss,ans);
ans =0;
}
else{
che =false;
break;
}
}
}
if(n.at(i)=='1')che=true;
}
if(che==true){
cout << ans <<endl;
}
else{
cout <<-1<<endl;
}
}
himo