結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>

int main() {
	int cnt[10] = { 1, 0, 0, 0, 1, 0, 1, 0, 2, 1 };

	std::string s;
	std::cin >> s;

	int ans1 = 1;
	for (char c : s) {
		ans1 += cnt[c - '0'] + 2;
	}

	int ans2 = 2;
	for (char c : s) {
		ans2 += cnt[c - '0'] * 2 + 1;
	}

	std::cout << std::min(ans1, ans2) << std::endl;
}
0