結果

問題 No.2920 Blood Type
ユーザー tenten
提出日時 2024-10-21 09:48:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 1,738 bytes
コンパイル時間 5,671 ms
コンパイル使用メモリ 91,112 KB
実行使用メモリ 51,448 KB
最終ジャッジ日時 2024-10-21 09:48:37
合計ジャッジ時間 7,071 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int[] ans = new int[4];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                if (s[i] == 'O' && t[j] == 'O') {
                    ans[3] += 25;
                } else if ((s[i] == 'A' && t[j] == 'B') || (s[i] == 'B' && t[j] == 'A')) {
                    ans[2] += 25;
                } else if (s[i] == 'A' || t[j] == 'A') {
                    ans[0] += 25;
                } else {
                    ans[1] += 25;
                }
            }
        }
        System.out.println(Arrays.stream(ans).mapToObj(String::valueOf).collect(Collectors.joining(" ")));
    }
}

class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");

    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}


0