답안 #124395

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124395 2019-07-03T09:28:05 Z KhalilBenGamra 이상한 기계 (APIO19_strange_device) Java 11
0 / 100
365 ms 122724 KB
import java.util.*;
import java.io.*;
public class strange_device {

	public static void main(String[] args)  throws IOException
	 { 
		 Scanner scan = new Scanner(System.in);
		 PrintWriter out=new PrintWriter(System.out);
		 int n = scan.nextInt();
		 int a = scan.nextInt();
		 int b = scan.nextInt();
		 int count = 0;
		 boolean [][] found = new boolean[10000][10000];
		 for (int i = 0; i < n; i++) {
			 int f = scan.nextInt();
			 int l = scan.nextInt();
			 for (int j = f; j <= l; j++) {
				int x = ((j+(int)Math.floor(j/b))%a);
				int y = j % b;
				//System.out.println("("+x+","+y+")");
				if(!found[x][y]){
					count ++;
					found[x][y] = true ;
				}
			}
		 }
		 out.println(count);
		 out.close();
	 }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 355 ms 122724 KB Output is correct
2 Runtime error 313 ms 122160 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 312 ms 122140 KB Output is correct
2 Runtime error 316 ms 122560 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 279 ms 122036 KB Output is correct
2 Runtime error 365 ms 122012 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 332 ms 121820 KB Output is correct
2 Runtime error 331 ms 122024 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 332 ms 121820 KB Output is correct
2 Runtime error 331 ms 122024 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 332 ms 121820 KB Output is correct
2 Runtime error 331 ms 122024 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 122036 KB Output is correct
2 Runtime error 280 ms 121808 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 355 ms 122724 KB Output is correct
2 Runtime error 313 ms 122160 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -