JAVA/오류고민

[백준] 10178번 할로윈의 사탕

(งᐛ)ว 2023. 11. 6. 23:57
728x90

 

 

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {	

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int t = Integer.parseInt(br.readLine());

				for (int i = 0; i < t; i++) {
					String [] temp = br.readLine().split(" ");
					int c = Integer.parseInt(temp[0]);
					int v = Integer.parseInt(temp[1]);

					System.out.printf("You get %d piece(s) and your dad gets %d piece(s).\n", c / v, c % v);
				}
				br.close();
	
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

 

 

728x90

'JAVA > 오류고민' 카테고리의 다른 글

[백준] 10872번 팩토리얼  (0) 2023.11.07
[백준] 10807번 개수 세기  (0) 2023.11.06
[백준] 2750번 수 정렬하기  (0) 2023.11.06
[백준] 10162번 전자레인지  (0) 2023.11.06
[백준] 2908번 상수  (0) 2023.10.23