結果
問題 |
No.2920 Blood Type
|
ユーザー |
👑 |
提出日時 | 2024-07-27 12:46:34 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 813 bytes |
コンパイル時間 | 1,190 ms |
コンパイル使用メモリ | 98,020 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-27 12:46:37 |
合計ジャッジ時間 | 2,250 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string S, T; cin >> S >> T; vector<int> answers = {0, 0, 0, 0}; for (char s: S) { for (char t: T) { vector<char> child = {s, t}; int a_count = count(child.begin(), child.end(), 'A'); int b_count = count(child.begin(), child.end(), 'B'); if (a_count >= 1 && b_count == 0) { answers[0] += 25; // A型の場合 } else if (a_count == 0 && b_count >= 1) { answers[1] += 25; // B型の場合 } else if (a_count >= 1 && b_count >= 1) { answers[2] += 25; // AB型の場合 } else { answers[3] += 25; // O型の場合 } } } for (int i = 0; i < answers.size() - 1; i++) { cout << answers[i] << " "; } cout << answers.back() << endl; return 0; }