본문 바로가기

Algorithm/SWEA

[SWEA] 2029. 몫과 나머지 출력하기 D1 JAVA

반응형


문제 이해

더보기

몫과 나머지를 출력한다

 

아이디어

 

코드

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 T = sc.nextInt();
		int a, b;

		for (int i = 0; i < T; i++) {
			a = sc.nextInt();
			b = sc.nextInt();
			System.out.println("#"+(i+1)+" "+a/b +" "+a%b);
		}
		sc.close();
	}
}

 

 


 

 

집사는개발자가되고파

 

choppadontbiteme.tistory.com

 

반응형