結果

問題 No.509 塗りつぶしツール
ユーザー Bantako
提出日時 2018-05-27 09:24:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 64,112 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 18:23:53
合計ジャッジ時間 1,325 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
main(){
    string S;
    cin >> S;
    int num[] = {1,0,0,0,1,0,1,0,2,1};
    int count = 0;
    for(int i = 0;i < S.size();i++){
        count += num[S[i]-'0'];
    }
    printf("%d\n",min(count+1+S.size()*2, (count + 1)*2 + S.size() ));
}
0