結果
| 問題 |
No.509 塗りつぶしツール
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-28 22:33:35 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 962 bytes |
| コンパイル時間 | 1,325 ms |
| コンパイル使用メモリ | 127,228 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 18:59:28 |
| 合計ジャッジ時間 | 2,258 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.container; // SList, DList, BinaryHeap
import std.typecons; // Tuple, Nullable, BigFlags
import std.math; // math functions
import std.numeric; // gcd
import std.bigint; // BigInt
import std.random; // random
import std.bitmanip; // BitArray
import core.bitop; // bit operation
import std.regex; // RegEx
import std.uni; // unicode
void main()
{
auto s = readln.chomp;
auto n = s.map!(c => c.to!string.to!int).array;
auto t = calc(n);
writeln(min(t + n.length + t, n.length + t + n.length));
}
auto calc(int[] n)
{
auto r = 1;
foreach (c; n) {
r += c.predSwitch(0, 1,
1, 0,
2, 0,
3, 0,
4, 1,
5, 0,
6, 1,
7, 0,
8, 2,
9, 1);
}
return r;
}