SWEA [D1] 1대1 가위바위보 - 1936 JAVA

YB·2026년 5월 16일
post-thumbnail

링크텍스트

설명

풀이 흐름 설명

시간복잡도: O(1), 공간복잡도: O(1)

회독

  • [ x ] 1회
  • 2회
  • 3회

코드

import java.util.Scanner;
import java.io.FileInputStream;

class Solution
{
	public static void main(String args[]) throws Exception
	{
	
		Scanner sc = new Scanner(System.in);
		
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(A==1){
            if(B==2){
                System.out.print("B");
            }else{
             	System.out.print("A");   
            }
        }else if(A==2){
            if(B==1){
             	System.out.print("A");   
            }else{
            	System.out.print("B");
            }
        }else{
            if(B==1){
             	System.out.print("B");   
            }else{
             	System.out.print("A");   
            }
        }
	}
}

profile
안녕하세요

0개의 댓글