結果
問題 |
No.509 塗りつぶしツール
|
ユーザー |
![]() |
提出日時 | 2017-04-29 03:41:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 882 bytes |
コンパイル時間 | 925 ms |
コンパイル使用メモリ | 106,112 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-09-13 19:00:14 |
合計ジャッジ時間 | 2,421 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; public class Program { public static void Main(string[] args) { new Magatro().Solve(); } } class Magatro { public void Solve() { var s = Console.ReadLine(); int ans = s.Length * 2 + 1; int ans2 = s.Length; int ana = 0; foreach (char c in s) { switch (c) { case '0': case '4': case '6': case '9': ana++; break; case '8': ana += 2; break; } } Console.WriteLine(Math.Min(ans+ana,ans2+(ana+1)*2)); } }