結果

問題 No.2920 Blood Type
コンテスト
ユーザー Onikawa Yozy
提出日時 2026-07-29 22:18:20
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 444µs
コード長 1,691 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,361 ms
コンパイル使用メモリ 351,100 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-29 22:18:29
合計ジャッジ時間 4,175 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    str s1, s2;
    cin >> s1 >> s2;
    ll a = 0, b = 0, ab = 0, o = 0;
    if (s1[0] == 'A')
    {
        if (s2[0] == 'A' || s2[0] == 'O') a++;
        else if (s2[0] == 'B') ab++;
        if (s2[1] == 'A' || s2[1] == 'O') a++;
        else if (s2[1] == 'B') ab++;
    }
    else if (s1[0] == 'B')
    {
        if (s2[0] == 'B' || s2[0] == 'O') b++;
        else if (s2[0] == 'A') ab++;
        if (s2[1] == 'B' || s2[1] == 'O') b++;
        else if (s2[1] == 'A') ab++;
    }
    else if (s1[0] == 'O')
    {
        if (s2[0] == 'O') o++;
        else if (s2[0] == 'A') a++;
        else if (s2[0] == 'B') b++;
        if (s2[1] == 'O') o++;
        else if (s2[1] == 'A') a++;
        else if (s2[1] == 'B') b++;
    }

    if (s1[1] == 'A')
    {
        if (s2[0] == 'A' || s2[0] == 'O') a++;
        else if (s2[0] == 'B') ab++;
        if (s2[1] == 'A' || s2[1] == 'O') a++;
        else if (s2[1] == 'B') ab++;
    }
    else if (s1[1] == 'B')
    {
        if (s2[0] == 'B' || s2[0] == 'O') b++;
        else if (s2[0] == 'A') ab++;
        if (s2[1] == 'B' || s2[1] == 'O') b++;
        else if (s2[1] == 'A') ab++;
    }
    else if (s1[1] == 'O')
    {
        if (s2[0] == 'O') o++;
        else if (s2[0] == 'A') a++;
        else if (s2[0] == 'B') b++;
        if (s2[1] == 'O') o++;
        else if (s2[1] == 'A') a++;
        else if (s2[1] == 'B') b++;
    }
    ll sum = a + b + ab + o;
    cout << a * 100 / sum << " " << b * 100 / sum << " " << ab * 100 / sum << " " << o * 100 / sum;
    return 0;
}
0