結果

問題 No.791 うし数列
ユーザー momoyuu
提出日時 2024-09-30 02:03:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 1,012 ms
コンパイル使用メモリ 92,136 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-30 02:03:08
合計ジャッジ時間 1,479 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string s;
    cin>>s;
    bool fn = true;
    int n = s.size();
    for(int i = 0;i<n;i++){
        if(i==0){
            if(s[i]!='1') fn = false;
        }else{
            if(s[i]!='3') fn = false;
        }
    }
    if(fn){
        int m = s.size();
        cout<<m-1<<endl;
    }else{
        cout<<-1<<endl;
    }
}   

0