結果

問題 No.509 塗りつぶしツール
ユーザー agisagis
提出日時 2017-04-29 00:29:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 164,920 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-11 20:48:24
合計ジャッジ時間 2,639 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,352 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,476 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	string n;
	cin >> n;
	int count1=0;
	int count2 = 0;
	for (int i = 0;i < n.size();i++) {
		if (n[i] == '0' || n[i] == '4' || n[i] == '6' || n[i] == '9') {
			count1 += 3;
		}
		else if (n[i] == '8') {
			count1 += 4;
		}
		else {
			count1 += 2;
		}
	}
	for (int i = 0;i < n.size();i++) {
		if (n[i] == '0' || n[i] == '4' || n[i] == '6' || n[i] == '9') {
			count2 += 3;
		}
		else if (n[i] == '8') {
			count2 += 5;
		}
		else {
			count2 += 1;
		}
	}
	count2+=2;
	cout << min(count1, count2) << endl;
	return 0;
}
0