Submission #1481809


Source Code Expand

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        long t_pre = 1, a_pre = 1;
        for(int i=0; i<n; i++){
            String[] str = br.readLine().split(" ");
            long t = Integer.parseInt(str[0]);
            long a = Integer.parseInt(str[1]);

            long rate = (long) Math.ceil(Math.max((double)t_pre/t, (double)a_pre/a));
            t_pre = rate * t;
            a_pre = rate * a;
        }
        System.out.println(t_pre + a_pre);
    }
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User kengo0o0
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 756 Byte
Status WA
Exec Time 95 ms
Memory 21700 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 11
WA × 4
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 67 ms 19156 KB
0_001.txt AC 68 ms 21332 KB
0_002.txt AC 66 ms 21076 KB
1_003.txt AC 67 ms 19412 KB
1_004.txt AC 87 ms 20420 KB
1_005.txt WA 84 ms 20820 KB
1_006.txt AC 87 ms 18500 KB
1_007.txt AC 73 ms 19156 KB
1_008.txt AC 70 ms 19412 KB
1_009.txt WA 69 ms 21076 KB
1_010.txt AC 69 ms 19284 KB
1_011.txt AC 69 ms 19156 KB
1_012.txt WA 70 ms 21204 KB
1_013.txt WA 87 ms 21700 KB
1_014.txt AC 95 ms 19380 KB