結果
| 問題 |
No.509 塗りつぶしツール
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-07 18:58:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 654 bytes |
| コンパイル時間 | 1,318 ms |
| コンパイル使用メモリ | 159,020 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 02:19:07 |
| 合計ジャッジ時間 | 2,233 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include "bits/stdc++.h"
#define fastcin {\
cin.tie(0);\
ios::sync_with_stdio(false);\
}
using namespace std;
int main() {
fastcin;
string n;
cin >> n;
long ans = 1;
long nh = 0, e = 0;
for(long i = 0; i < n.length(); i++) {
if(n[i] == '0' || n[i] == '4' || n[i] == '6' || n[i] == '9') {
ans += 3;
} else if(n[i] == '1' || n[i] == '2' || n[i] == '3' || n[i] == '5' || n[i] == '7') {
ans += 2;
nh++;
} else {
ans += 4;
e++;
}
}
if(nh - 1 - e > 0) {
ans -= nh - 1 - e;
}
cout << ans << '\n';
return 0;
}