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