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