結果

問題 No.509 塗りつぶしツール
ユーザー tanimani364tanimani364
提出日時 2021-03-29 17:45:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 80,900 KB
最終ジャッジ日時 2023-08-19 16:18:34
合計ジャッジ時間 7,118 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
80,464 KB
testcase_01 AC 177 ms
80,572 KB
testcase_02 AC 173 ms
80,632 KB
testcase_03 AC 173 ms
80,720 KB
testcase_04 AC 167 ms
80,500 KB
testcase_05 AC 172 ms
80,448 KB
testcase_06 AC 176 ms
80,732 KB
testcase_07 AC 178 ms
80,676 KB
testcase_08 AC 173 ms
80,608 KB
testcase_09 AC 178 ms
80,484 KB
testcase_10 AC 176 ms
80,680 KB
testcase_11 AC 177 ms
80,680 KB
testcase_12 AC 172 ms
80,352 KB
testcase_13 AC 175 ms
80,500 KB
testcase_14 AC 180 ms
80,628 KB
testcase_15 AC 173 ms
80,496 KB
testcase_16 AC 176 ms
80,544 KB
testcase_17 AC 176 ms
80,900 KB
testcase_18 AC 172 ms
80,452 KB
testcase_19 AC 176 ms
80,628 KB
testcase_20 AC 174 ms
80,404 KB
testcase_21 AC 177 ms
80,712 KB
testcase_22 AC 173 ms
80,452 KB
testcase_23 AC 176 ms
80,836 KB
testcase_24 AC 174 ms
80,400 KB
testcase_25 AC 171 ms
80,612 KB
testcase_26 AC 177 ms
80,484 KB
testcase_27 AC 173 ms
80,400 KB
testcase_28 AC 168 ms
80,400 KB
testcase_29 AC 173 ms
80,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#coding:utf-8

import math
import string
import random
import heapq
from sys import stdin
# import numpy as np
# from matplotlib import pyplot as plt
	
def add(c):
	if c=='0':
		return 1
	elif c=='4':
		return 1
	elif c=='6':
		return 1
	elif c=='8':
		return 2
	elif c=='9':
		return 1
	else :
		return 0

def main():
	read=stdin.readline

	#edit here!
	s=read()
	n=len(s)
	n-=1
	ans=n*2+1
	for i in range(n):
		ans+=add(s[i])
	res=n+2
	for i in range(n):
		res+=2*add(s[i])
	if ans>res:
		ans=res
	print(ans)

if __name__ == '__main__':
	main()
0