結果

問題 No.791 うし数列
ユーザー T.Stream
提出日時 2021-02-04 13:57:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 192,264 KB
最終ジャッジ日時 2025-01-18 11:15:11
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int i;
	string s;
	cin >> s;
	if(s.size()==1){
		cout << -1 << endl; return 0;
	}
	for(i=0; i<s.size(); i++){
		if(i==0 && s[i]=='1'){
			
		}else if(i>0 && s[i]=='3'){
			
		}else{
			cout << -1 << endl; return 0;
		}
	}
	cout << s.size()-1 << endl;
	return 0;
}
0