백준 #26340번 Fold the Paper Nicely

jhj·2024년 2월 15일

백준 JAVA

목록 보기
324/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			System.out.println("Data set: " + a + " " + b + " " + c);
			
			for(int j = 1; j <= c; j++) {
				if(a >= b) {
					a = a / 2;
				}else if(a < b) {
					b = b / 2;
				}
			}
			
			if(a > b) {
				System.out.println(a + " " + b);
			}else {
				System.out.println(b + " " + a);
			}
			System.out.println();
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글