๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm

[Codeforces] 1191A: Tokitsukaze and Enhancement

by ์ฃผ๋ฐœ2 2020. 3. 24.
๋ฐ˜์‘ํ˜•

https://codeforces.com/problemset/problem/1191/A

 

Problem - 1191A - Codeforces

 

codeforces.com

์ฝ”๋“œ

import java.util.Scanner;

public class A1191 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int x = scan.nextInt();
		
		if(x%4 == 0)
			System.out.println("1 A");
		else if(x%4 == 1)
			System.out.println("0 A");
		else if(x%4 == 2)
			System.out.println("1 B");
		else
			System.out.println("2 A");
		scan.close();
	}

}

ํ’€์ด

๊ฒฝ์šฐ์˜ ์ˆ˜๊ฐ€ 4๊ฐœ๋ฐ–์— ์—†์œผ๋ฏ€๋กœ, ๊ฐ๊ฐ์˜ ์ผ€์ด์Šค์— ๋งž๊ฒŒ ์ถœ๋ ฅํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

A - 4๋กœ ๋‚˜๋ˆด์„๋•Œ ๋‚˜๋จธ์ง€ 1

B - 4๋กœ ๋‚˜๋ˆด์„๋•Œ ๋‚˜๋จธ์ง€ 3

C - 4๋กœ ๋‚˜๋ˆด์„๋•Œ ๋‚˜๋จธ์ง€ 2

D - 4๋กœ ๋‚˜๋ˆด์„๋•Œ ๋‚˜๋จธ์ง€ 0

HP์˜ ์ตœ๋Œ€๊ฐ’์€ A>B>C>D ์ด๋ฏ€๋กœ A์™€ ๊ฐ€๊น๊ฒŒ ์ตœ๋Œ€ํ•œ ๋งž์ถฐ์ฃผ๋ฉด ๋œ๋‹ค.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€