結果

問題 No.509 塗りつぶしツール
ユーザー masa
提出日時 2017-05-15 21:30:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 66,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 08:10:59
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main() {
	string s;
	cin >> s;

	int holes[] = {1, 0, 0, 0, 1, 0, 1, 0, 2, 1};
	int n_hole = 0;
	for (auto c : s) {
		n_hole += holes[c - '0'];
	}

	int ans = s.size() * 2 + 1;

	int n = s.size();

	// 字を先
	int x = n + n_hole + 1 + n;
	// 外を先
	int y = 1 + n_hole + n + 1 + n_hole;

	cout << min(x, y) << endl;
	return 0;
}
0