#include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x)) #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))< ostream& operator<<(ostream& o, const pair &p){o<<"("< ostream& operator<<(ostream& o, const vector &v){o<<"[";for(T t:v){o<>s; // 0,1,2,3,4,5,6,7,8,9 int arr[10] = {1,0,0,0,1,0,1,0,2,1}; // 文字を別の色 int ans1 = s.size()*2+1; for(auto i : s) ans1 += arr[i-'0']; // 背景を別の色 int ans2 = s.size() + 2; for(auto i : s) ans2 += arr[i-'0']*2; cout << min(ans1,ans2) << endl; return 0; }