結果
| 問題 | No.791 うし数列 | 
| コンテスト | |
| ユーザー |  rtia_iidx | 
| 提出日時 | 2019-02-22 21:22:26 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 793 bytes | 
| コンパイル時間 | 735 ms | 
| コンパイル使用メモリ | 100,020 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-25 05:04:58 | 
| 合計ジャッジ時間 | 1,472 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 | 
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
using namespace std;
#define ll long long int
ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string str;
    cin >> str;
    bool ok = true;
    if(str[0] != '1'){
        ok = false;
    }
    for(int i = 1; i < str.size(); i++){
        if(str[i] != '3'){
            ok = false;
        }
    }
    if(ok && str.size() > 1){
        cout << str.size() - 1 << endl;
    }else{
        cout << -1 << endl;
    }
    
    return 0;
}
            
            
            
        