結果
問題 | No.791 うし数列 |
ユーザー |
|
提出日時 | 2019-03-13 23:56:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 365 bytes |
コンパイル時間 | 653 ms |
コンパイル使用メモリ | 73,572 KB |
最終ジャッジ日時 | 2025-01-06 22:07:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #define int long long using namespace std; signed main() { string s; cin >> s; bool b = 1; if (s[0] != '1')b = 0; for (int i = 1; i < s.size(); i++)if (s[i] != '3')b = 0; if(s.size() == 1) cout << "-1\n"; else if (b)cout << s.size() - 1 << endl; else cout << -1 << endl; cin >> s; }