Submission #931985
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n,a,b;
ll na=1,nb=1;
cin>>n;
while(n--){
cin>>a>>b;
ll m = na/a;
if(na%a) m++;
if(m<=nb/b){
m=nb/b;
if(nb%b) m++;
}
na=a*m;
nb=b*m;
}
cout<<na+nb<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - AtCoDeer and Election Report |
| User | mgr0204 |
| Language | C++14 (GCC 5.4.1) |
| Score | 300 |
| Code Size | 333 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 384 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 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 | AC | 3 ms | 256 KiB |
| 0_001.txt | AC | 3 ms | 256 KiB |
| 0_002.txt | AC | 3 ms | 256 KiB |
| 1_003.txt | AC | 3 ms | 384 KiB |
| 1_004.txt | AC | 3 ms | 256 KiB |
| 1_005.txt | AC | 3 ms | 384 KiB |
| 1_006.txt | AC | 3 ms | 256 KiB |
| 1_007.txt | AC | 3 ms | 256 KiB |
| 1_008.txt | AC | 3 ms | 256 KiB |
| 1_009.txt | AC | 3 ms | 256 KiB |
| 1_010.txt | AC | 3 ms | 256 KiB |
| 1_011.txt | AC | 3 ms | 256 KiB |
| 1_012.txt | AC | 3 ms | 256 KiB |
| 1_013.txt | AC | 3 ms | 256 KiB |
| 1_014.txt | AC | 3 ms | 256 KiB |