結果

問題 No.509 塗りつぶしツール
ユーザー conankun
提出日時 2017-12-16 23:09:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-14 21:59:33
合計ジャッジ時間 1,660 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;

void swap(int &a, int &b) {
    a ^= b;
    b ^= a;
    a ^= b;
}

uint tzcnt(uint x) {
    x = ~x & (x - 1);
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string n;
    cin >> n;

    const int ccount[] = { 1, 0, 0, 0, 1, 0, 1, 0, 2, 1 };

    int res1 = 1;
    int res2 = 2;
    for (int i = 0; i < n.length(); i++) {
        res1 += ccount[n[i] - '0'] + 2;
        res2 += ccount[n[i] - '0'] * 2 + 1;
    }

    out(min(res1, res2));

    int ttttttt;
    cin >> ttttttt;
}
0