結果

問題 No.791 うし数列
ユーザー 3_3_nk3_3_nk
提出日時 2019-05-21 11:47:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,534 bytes
コンパイル時間 1,012 ms
コンパイル使用メモリ 92,000 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 10:29:43
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <utility>
#define rep(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define prep(i, s, x) for(int (i) = (s); (i) < (x); (i) ++) 
#define mrep(i, s, x) for(int (i) = (s); (i) >= (x); (i) --)
#define irep(i) for(int (i) = 0; ; (i) ++)
#define MOD 1000000007
#define PI (acos(-1))
typedef long long LL;
// long long型の最大値:LLONG_MAX
// long long型の最小値:LLONG_MIN
// int型の最大値:INT_MAX
// int型の最小値:INT_MIN
// 絶対値:abs(n)
// べき乗:pow(a, b)
// ルート:sqrt(n)
// 文字列反転:reverse(str.begin(), str.end())
// 降順(大きい順)にソート:第3引数にgreater<int>()
// 重複する要素を削除しvectorの長さを調節する:v.erase(unique(v.begin(), v.end()), v.end())
// stackは後に入れたものから、queueは先に入れたものから
// stack.top() queue.front() で要素にアクセス
// ループ用変数以外はlong long型にしよう
using namespace std;

int main(){
	string n;
	cin >> n;
	if(n == "1"){
		cout << -1 << endl;
		return 0;
	}
	rep(i, n.length()){
		if(i == 0){
			if(n[i] != '1'){
				cout << -1 << endl;
				return 0;
			}
		}else{
			if(n[i] != '3'){
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << n.length() - 1 << endl;
	return 0;
}
0