結果
| 問題 | 
                            No.509 塗りつぶしツール
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-05-04 20:54:23 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 353 bytes | 
| コンパイル時間 | 2,650 ms | 
| コンパイル使用メモリ | 191,488 KB | 
| 最終ジャッジ日時 | 2025-01-10 06:34:51 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
	int f[128];
	f['0']=1;
	f['1']=0;
	f['2']=0;
	f['3']=0;
	f['4']=1;
	f['5']=0;
	f['6']=1;
	f['7']=0;
	f['8']=2;
	f['9']=1;
	string s; cin>>s;
	int m=s.length();
	int hole=1;
	rep(i,m) hole+=f[s[i]];
	cout<<min(2*m+hole,m+2*hole)<<'\n';
	return 0;
}