結果
| 問題 |
No.509 塗りつぶしツール
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2018-04-17 03:02:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 686 bytes |
| コンパイル時間 | 828 ms |
| コンパイル使用メモリ | 83,952 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 04:09:05 |
| 合計ジャッジ時間 | 1,835 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
string s;
cin >> s;
int n = s.length();
int a = 0;
for ( int i = 0; i < n; i++ ) {
if ( s[i] == '0' || s[i] == '4' || s[i] == '6' || s[i] == '9' ) {
a++;
}
else if ( s[i] == '8' ) { a += 2; }
}
if ( n < a+1 ) {
cout << n*2+a+1 << endl;
}
else {
cout << (a+1)*2+n << endl;
}
return 0;
}
tetsuzuki1115