結果
| 問題 | No.791 うし数列 | 
| コンテスト | |
| ユーザー |  tokutaro | 
| 提出日時 | 2020-03-21 10:26:23 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 341 bytes | 
| コンパイル時間 | 5,072 ms | 
| コンパイル使用メモリ | 211,920 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-18 00:46:03 | 
| 合計ジャッジ時間 | 5,557 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 | 
ソースコード
#include <iostream>
#include <regex>
#include <algorithm>
using namespace std;
int main() {
    string N;
    cin >> N;
    regex re("^1(3+)$");
    smatch s;
    if (regex_match(N, s, re)) {
        string ss = s[0];
        cout << count(ss.begin(), ss.end(), '3') << endl;
    } else {
        cout << "-1" << endl;
    }
    return 0;
}
            
            
            
        