結果
| 問題 | No.2920 Blood Type | 
| コンテスト | |
| ユーザー |  aketijyuuzou | 
| 提出日時 | 2025-02-11 14:08:00 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 35 ms / 2,000 ms | 
| コード長 | 2,054 bytes | 
| コンパイル時間 | 3,023 ms | 
| コンパイル使用メモリ | 106,240 KB | 
| 実行使用メモリ | 18,560 KB | 
| 最終ジャッジ日時 | 2025-02-11 14:08:05 | 
| 合計ジャッジ時間 | 4,969 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 36 | 
コンパイルメッセージ
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.Generic;
using System.Linq;
class Program
{
    static string InputPattern = "InputX";
    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();
        if (InputPattern == "Input1") {
            WillReturn.Add("AO");
            WillReturn.Add("BO");
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("AB");
            WillReturn.Add("OO");
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("AO");
            WillReturn.Add("AB");
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }
    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[0];
        string T = InputList[1];
        int Bunbo = S.Length * T.Length;
        var CntDict = new Dictionary<string, int>();
        CntDict["A"] = 0;
        CntDict["B"] = 0;
        CntDict["AB"] = 0;
        CntDict["O"] = 0;
        foreach (char EachChar1 in S) {
            foreach (char EachChar2 in T) {
                string BloodType = DeriveBloodType(EachChar1.ToString(), EachChar2.ToString());
                CntDict[BloodType]++;
            }
        }
        Console.WriteLine("{0} {1} {2} {3}",
            CntDict["A"] * 100 / Bunbo,
            CntDict["B"] * 100 / Bunbo,
            CntDict["AB"] * 100 / Bunbo,
            CntDict["O"] * 100 / Bunbo);
    }
    // 文字列を引数として、血液型を返す
    static string DeriveBloodType(string p1, string p2)
    {
        string ConcatStr = p1 + p2;
        if (ConcatStr.Contains("A") && ConcatStr.Contains("B") == false) {
            return "A";
        }
        if (ConcatStr.Contains("B") && ConcatStr.Contains("A") == false) {
            return "B";
        }
        if (ConcatStr.Contains("A") && ConcatStr.Contains("B")) {
            return "AB";
        }
        return "O";
    }
}
            
            
            
        