Submission #1481810
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)); rate = rate == 1 ? 2 : rate; 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 | 798 Byte |
Status | WA |
Exec Time | 99 ms |
Memory | 22468 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||
Status |
|
|
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 | WA | 68 ms | 19284 KB |
0_001.txt | WA | 68 ms | 18516 KB |
0_002.txt | WA | 68 ms | 19284 KB |
1_003.txt | WA | 68 ms | 19284 KB |
1_004.txt | WA | 99 ms | 21828 KB |
1_005.txt | WA | 77 ms | 20436 KB |
1_006.txt | WA | 98 ms | 21700 KB |
1_007.txt | WA | 73 ms | 18260 KB |
1_008.txt | WA | 71 ms | 21076 KB |
1_009.txt | WA | 78 ms | 19156 KB |
1_010.txt | WA | 69 ms | 19540 KB |
1_011.txt | WA | 79 ms | 20692 KB |
1_012.txt | WA | 70 ms | 19796 KB |
1_013.txt | WA | 86 ms | 22468 KB |
1_014.txt | WA | 99 ms | 22196 KB |