結果
問題 |
No.509 塗りつぶしツール
|
ユーザー |
|
提出日時 | 2019-01-17 00:24:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 167,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 06:35:12 |
合計ジャッジ時間 | 2,521 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int len = (int)s.length(); int hole = 0; for(int i = 0; i < len; i++) { int a = s[i] - '0'; if(a == 0 || a == 6 || a == 9 || a == 4) hole++; if(a == 8) hole += 2; } cout << min(len * 2 + hole + 1, (hole + 1) * 2 + len) << endl; return 0; }