結果

問題 No.791 うし数列
ユーザー Mayimg
提出日時 2019-02-23 10:05:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 192,728 KB
最終ジャッジ日時 2025-01-06 21:44:17
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	if (s[0] != '1') {
		cout << -1 << endl;
		return 0;
	}
	if ((int) s.length() == 1) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 2; i < (int) s.length(); i++) {
		if (s[i] != '3') {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << (int) s.length() - 1 << endl;
	return 0;	
}
0