結果

問題 No.509 塗りつぶしツール
ユーザー 🍮かんプリン
提出日時 2019-03-21 11:31:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 673 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 62,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 01:26:42
合計ジャッジ時間 1,424 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <stack>
using ll = long long;
#define MOD 1000000007
using namespace std;

int main(){
    string n;
    ll cnt = 0;
    cin >> n;
    for(int i = 0; i < (int)n.length(); i++)
    {
        switch (n[i]) {
            case '0':
            case '4':
            case '6':
            case '9':
                cnt++;
                break;
            case '8':
                cnt+=2;
                break;
            default:
                break;
        }
    }
    cout << min(cnt + (ll)n.length() + 1 + (ll)n.length(),2*(cnt + 1) + (int)n.length()) << endl;
}
0