結果
問題 |
No.791 うし数列
|
ユーザー |
![]() |
提出日時 | 2020-04-27 01:15:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 166,032 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 05:42:44 |
合計ジャッジ時間 | 2,317 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int len = s.size(); 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; } } */ }