Submission #928747


Source Code Expand

import java.util.Scanner;

public class Main {
    public static void main(String args[] ) throws Exception {
    	new Main().exec(args);
    }

    public Main() {
    }

    public void exec(String args[]) throws Exception {
    	//初期化読み込み
    	Scanner sc = new Scanner(System.in);
    	int N=sc.nextInt();

    	long ansT = 0;
    	long ansA = 0;

    	for(int i=0; i<N; i++) {
    		long T=sc.nextInt();
    		long A=sc.nextInt();
    		if(i==0 || (ansT <= T && ansA <= A)) {
    			ansT = T;
    			ansA = A;
    		}else {
    			double hiT = (double)ansT/T;
    			double hiA = (double)ansA/A;
    			int hi = (int)Math.ceil(Math.max(hiT, hiA));
    			ansT = T*hi;
    			ansA = A*hi;
    		}
    	}
    	System.out.println(ansA+ansT);
	}
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User urumeiwashi
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 795 Byte
Status WA
Exec Time 184 ms
Memory 13400 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 6
WA × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt
Case Name Status Exec Time Memory
0_000.txt AC 132 ms 9676 KB
0_001.txt AC 130 ms 9680 KB
0_002.txt AC 128 ms 9680 KB
1_003.txt AC 131 ms 9680 KB
1_004.txt AC 180 ms 13272 KB
1_005.txt WA 152 ms 10564 KB
1_006.txt WA 160 ms 11280 KB
1_007.txt WA 165 ms 10816 KB
1_008.txt WA 142 ms 9940 KB
1_009.txt WA 136 ms 9808 KB
1_010.txt WA 133 ms 9808 KB
1_011.txt WA 138 ms 9808 KB
1_012.txt WA 139 ms 9800 KB
1_013.txt WA 184 ms 13284 KB
1_014.txt AC 184 ms 13400 KB