結果

問題 No.509 塗りつぶしツール
ユーザー olphe
提出日時 2017-04-28 22:32:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 945 ms
コンパイル使用メモリ 108,876 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 18:05:10
合計ジャッジ時間 1,874 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N, K;
int num[10] = { 1,1,1,1,1,1,1,1,1,1 };
int box[10] = { 1,0,0,0,1,0,1,0,2,1 };
int a = 1;
int b = 0;

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	if (!N) {
		a += 1;
		b += 1;
	}
	while (N) {
		a += box[N % 10];
		b += num[N % 10];
		N /= 10;
	}
	cout << min(a * 2 + b, b * 2 + a) << endl;
	return 0;
}
0