結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-19 22:24:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 590 bytes |
| コンパイル時間 | 589 ms |
| コンパイル使用メモリ | 59,988 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 09:38:29 |
| 合計ジャッジ時間 | 1,279 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
int main()
{
std::string s;
std::cin >> s;
int cnt = -1;
for(auto i = s.begin(); i != s.end(); i++){
char c = *i;
if(cnt == -1){
if(c != '1'){
std::cout << -1 << std::endl;
return 0;
}
} else {
if(c != '3'){
std::cout << -1 << std::endl;
return 0;
}
}
cnt++;
}
if(cnt == 0) cnt = -1;
std::cout << cnt << std::endl;
return 0;
}