結果
問題 |
No.791 うし数列
|
ユーザー |
|
提出日時 | 2019-08-27 10:57:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 1,874 ms |
コンパイル使用メモリ | 167,828 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 04:19:31 |
合計ジャッジ時間 | 2,469 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 6 |
ソースコード
/** @file 791.cpp @title No.791 うし数列 - yukicoder @url https://yukicoder.me/problems/no/791 **/ #include <bits/stdc++.h> using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) int main() { LL N; cin >> N; string strN = to_string(N); if (strN.front() != '1' || (int)strN.size() == 1) { cout << "-1" << endl; exit(0); } int ans = 0; for (int i = 1; i < (int)strN.size(); i++) { if (strN[i] == '3') { ans++; } else { cout << "-1" << endl; exit(0); } } cout << ans << endl; return 0; }