結果

問題 No.791 うし数列
ユーザー hiro_ei1812
提出日時 2019-08-14 18:42:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 55,204 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 14:32:30
合計ジャッジ時間 974 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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();

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

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