結果

問題 No.791 うし数列
ユーザー yumakmc
提出日時 2019-02-22 21:25:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 1,216 ms
コンパイル使用メモリ 159,716 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 05:14:20
合計ジャッジ時間 1,789 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;

int main() {
	string st;cin>>st;
	int answer=-1;
	if (st[0] == '1') {
		answer=0;
		int now=1;
		while (st.size() != now) {
			if (st[now] == '3') {
				answer++;
			}
			else {
				answer=-1;
				break;
			}
			now++;
		}
	}
	if(answer==0)answer=-1;
	cout<<answer<<endl;
   return 0;
}
0