結果
問題 | No.2920 Blood Type |
ユーザー |
|
提出日時 | 2024-12-01 07:21:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 2,372 ms |
コンパイル使用メモリ | 193,948 KB |
最終ジャッジ日時 | 2025-02-26 09:56:08 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include<bits/stdc++.h>using namespace std;char findnw(char c1,char c2) {if ((c1 == 'A' && c2 != 'B') || (c1 != 'B' && c2 == 'A')) {return 'A';}else if ((c1 == 'B' && c2 != 'A') || (c1 != 'A' && c2 == 'B')) {return 'B';}else if ((c1 == 'A' && c2 == 'B') || (c1 == 'B' && c2 == 'A')) {return 'C'; //AB}else {return 'O';}}int main() {string s, t;cin >> s >> t;double a = 0, b = 0, ab = 0, o = 0;for (int i = 0; i < 2; i++) {for (int j = 0; j < 2; j++) {if (findnw(s.at(i), t.at(j)) == 'A') a++;else if (findnw(s.at(i), t.at(j)) == 'B') b++;else if (findnw(s.at(i), t.at(j)) == 'C') ab++;else o++;}}cout << a / 4 * 100 << ' ' << b / 4 * 100 << ' ';cout << ab / 4 * 100 << ' ' << o / 4 * 100 << endl;}