結果
| 問題 | 
                            No.509 塗りつぶしツール
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Dameningen
                         | 
                    
| 提出日時 | 2017-04-28 23:29:38 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,263 bytes | 
| コンパイル時間 | 916 ms | 
| コンパイル使用メモリ | 89,532 KB | 
| 実行使用メモリ | 16,960 KB | 
| 最終ジャッジ日時 | 2024-09-13 18:36:51 | 
| 合計ジャッジ時間 | 7,099 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | TLE * 1 -- * 2 | 
| other | -- * 27 | 
ソースコード
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main()
{
    int n;
    cin >> n;
    
    
    int ans = 1, k, m;
    int add[10] = {3,2,2,2,3,2,3,2,4,3};
    int add2[10] = {3,1,1,1,3,1,3,1,4,3};
    m = n;
    do {
        k = m % 10;
        n = m / 10;
        ans += add[k];
    } while (m != 0);
    
    m = n;
    int ans2 = 2;
    do {
        k = m % 10;
        n = m / 10;
        ans2 += add2[k];
    } while (m != 0);
    
    cout << (ans<ans2 ? ans : ans2) << endl;
    return 0;
}
            
            
            
        
            
Dameningen