본문 바로가기
Algorithm/BaekJoon[Java]

백준 10430

by 씨니 2022. 3. 30.
728x90

▶ 10430문제 - 나머지

 

▶ 풀이방법

import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		int a = Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		int c = Integer.parseInt(st.nextToken());
		
		bw.write(String.valueOf((a+b)%c) + "\n");
		bw.write(String.valueOf(((a%c) + (b%c))%c) + "\n");
		bw.write(String.valueOf((a*b)%c) + "\n");
		bw.write(String.valueOf(((a%c)*(b%c))%c) + "\n");
		
		bw.flush();
		bw.close();
		br.close();
	}
}
728x90

'Algorithm > BaekJoon[Java]' 카테고리의 다른 글

백준 1934  (0) 2022.03.30
백준 2609  (0) 2022.03.30
백준 1406  (0) 2022.03.30
백준 1158  (0) 2022.03.29
백준 11655  (0) 2022.03.29