結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
Ichimiya
|
| 提出日時 | 2020-04-27 01:17:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 773 bytes |
| コンパイル時間 | 1,612 ms |
| コンパイル使用メモリ | 166,456 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 05:45:56 |
| 合計ジャッジ時間 | 2,335 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int len = s.size();
if (len < 2) {
cout << -1 << endl;
return 0;
}
int c = 0;
for (int i = 0; i < len; i++) {
if (i == 0) {
if (s.at(i) != '1') {
cout << -1 << endl;
return 0;
}
}
else {
if (s.at(i) == '3') {
c++;
}
else {
cout << -1 << endl;
return 0;
}
}
}
cout << c << endl;
/*
int64_t N;
cin >> N;
if (N < 13) {
cout << -1 << endl;
return 0;
}
int c = 0;
while (N > 0) {
if (N % 10 == 3) {
c++;
N /= 10;
if (N < 10) {
if (N == 1) {
cout << c << endl;
return 0;
}
else {
cout << -1 << endl;
return 0;
}
}
}
else {
cout << -1 << endl;
break;
}
}
*/
}
Ichimiya