結果
| 問題 |
No.2920 Blood Type
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 14:38:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 691 bytes |
| コンパイル時間 | 2,155 ms |
| コンパイル使用メモリ | 198,724 KB |
| 最終ジャッジ日時 | 2025-02-24 17:37:14 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
int n = s.size(), m = t.size();
vector<int> c(4, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
string x = "";
x += s[i];
x += t[j];
sort(x.begin(), x.end());
if (x == "AA" || x == "AO") c[0]++;
else if (x == "BB" || x == "BO") c[1]++;
else if (x == "AB") c[2]++;
else c[3]++;
}
}
int su = 0;
for (int i = 0; i < 4; i++) su += c[i];
for (int i = 0; i < 4; i++) {
cout << c[i] * 100 / su << " \n"[i == 4 - 1];
}
return 0;
}