結果
問題 | No.785 色食い虫 |
ユーザー |
![]() |
提出日時 | 2019-12-07 20:00:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 1,583 bytes |
コンパイル時間 | 4,448 ms |
コンパイル使用メモリ | 103,296 KB |
実行使用メモリ | 19,584 KB |
最終ジャッジ日時 | 2024-12-26 05:13:07 |
合計ジャッジ時間 | 5,360 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization.Formatters; using static System.Console; using static System.Math; namespace YukiCoder { public class Program { public static void Main(string[] args) { new Program().Solve(); } public void Solve() { string R = ReadLine(); string G = ReadLine(); string B = ReadLine(); long r, g, b; WriteLine(CalcRGB(R) * CalcRGB(G) * CalcRGB(B)); } public static double CalcRGB(string R) { double n = 0; if (R.Contains(",")) { n = 15 - CountOf(R, ","); } else { n = 15; if (R == "NONE") { n = 16; } } return Pow(n,2); } /// <summary> /// 指定した文字列がいくつあるか /// </summary> public static int CountOf(string target, params string[] strArray){ int count = 0; foreach (string str in strArray) { int index = target.IndexOf (str, 0); while (index != -1) { count++; index = target.IndexOf (str, index + str.Length); } } return count; } } }