結果

問題 No.509 塗りつぶしツール
ユーザー oxyshower
提出日時 2020-01-12 14:32:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 166,192 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-29 02:39:36
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n; cin >> n;
  if(n == 0){
    cout << 4 << endl;
    return 0;
  }

  int cnt = 0, ana = 0;
  while(n > 0){
    if(n % 10 == 6 || n % 10 == 9 || n % 10 == 0 || n % 10 == 4) ana++;
    if(n % 10 == 8) ana += 2;
    n /= 10;
    cnt++;
  }
  cout << min(2 * cnt + ana + 1, 2 * (ana + 1) + cnt) << endl;

  return 0;
}
0