結果

問題 No.509 塗りつぶしツール
ユーザー naipianaipia
提出日時 2018-06-09 19:28:26
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 1,319 ms
コンパイル使用メモリ 160,172 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 12:59:06
合計ジャッジ時間 2,116 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,ans=0,ans2=0;
    cin >> n;
    if(n==0){cout<<4<<endl;return 0;}
    while(n!=0){
        ans++;ans2+=2;
        int tmp=n%10;
        if(tmp==0||tmp==4||tmp==6||tmp==9){ans+=2;ans2++;}
        if(tmp==8){ans+=4;ans2+=2;}
        n/=10;
    }
    if(ans+2<ans2+1) cout << ans+2 << endl;
    else cout << ans2+1 << endl;

    return 0;
}
0