結果
問題 | No.509 塗りつぶしツール |
ユーザー |
|
提出日時 | 2018-11-14 22:34:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 564 ms |
コンパイル使用メモリ | 64,256 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 13:52:03 |
合計ジャッジ時間 | 1,576 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <iostream> #include <string> using namespace std; struct X{ int n; int num; } digit[]={ {0,1}, {1,0}, {2,0}, {3,0}, {4,1}, {5,0}, {6,1}, {7,0}, {8,2}, {9,1} }; int main(int argc, char* argv[]) { string S; cin>>S; int Sum=0; int Len=S.length(); int kuchi=0; for (int i=0;i<S.size();i++){ int N=S[i]-'0'; for (int j=0;j<10;j++){ if (N==digit[j].n){ kuchi+=digit[j].num; } } } int x=2*Len+1+kuchi; int y=2*(1+kuchi)+Len; cout<<min(x,y)<<endl; return 0; }