BackJoon Algorithm - Java
문제
풀이
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Back_23971 {
public static void main(String[] args) throws IOException {
// given
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int H = Integer.parseInt(st.nextToken());
int W = Integer.parseInt(st.nextToken());
int N = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());
int count = 0;
// when
for (int i = 1; i <= H; i = i + N + 1) {
for (int j = 1; j <= W; j = j + M + 1){
count ++;
}
}
// then
System.out.println(count);
br.close();
}
}
댓글남기기