結果

問題 No.791 うし数列
ユーザー hiro_ei1812hiro_ei1812
提出日時 2019-08-14 18:31:43
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 54,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 14:32:24
合計ジャッジ時間 980 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(){
	string in;
	int i,n;
	int count=0;
	int len;

	cin>>in;

	if(in[0]!='1'){
		cout<<"-1"<<endl;
		return 0;
	}
	
	len=in.length()-1;

	for(i=1;in[i]=='3';i++){
		count++;
	}
	
	if(count==len){
		cout<<count<<endl;
		return 0;
	}

	cout<<"-1"<<endl;
	return 0;
}
0