Submission #928298
Source Code Expand
/*input
3
2 3
1 1
3 2
*/
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
long long mod=1e9+7;
typedef long long int lld;
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scd(a) scanf("%d",&a)
#define scd2(a,b) scanf("%d%d",&a,&b)
#define scd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scf(a) scanf("%lf",&a)
#define scf2(a,b) scanf("%lf%lf",&a,&b)
#define scf3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define Error(x) cerr << #x << " = " << (x) <<endl;
#define Error2(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c) cerr<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d) cerr<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define popcount __builtin_popcountll
typedef pair<lld,lld> PA;
#define lim 1000010
#define lim2 3003
// inline lld sqr(lld x) { return x * x; }
// map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];
lld B[lim],A[lim];
lld n,m,p,q;
string S[lim];
lld powP(lld a,lld b){
if(b==0) return 1%mod;
lld k;
k=powP(a,b/2);
k=k*k%mod;
if(b%2==0) return k;
else return a*k%mod;
}
bool bitSet(lld n,lld i){
if((n&(1<<i))!=0) return true;
else return false;
}
void mmod(long long int& cur) {
while (cur >= mod) {
cur -= mod;
}
}
int main(){
lld T,i,j,h,l,r,k,s,b,c,a,d,w,x,y,v,z,t,curr,prev,sum,ans,pos,val,countA,secondMin,indicator;
sc(n);
rep(i,1,n) sc2(A[i],B[i]);
a=A[1];
b=B[1];
rep(i,2,n){
c=((a-1)/A[i]+1)*A[i];
d=((b-1)/B[i]+1)*B[i];
t=max(c/A[i],d/B[i]);
a=A[i]*t;
b=B[i]*t;
// Error2(a,b);
}
prL(a+b);
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:76:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
sc(n);
^
./Main.cpp:77:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i,1,n) sc2(A[i],B[i]);
^
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 |
12 ms |
8064 KB |
0_001.txt |
AC |
12 ms |
8064 KB |
0_002.txt |
AC |
12 ms |
8064 KB |
1_003.txt |
AC |
12 ms |
8064 KB |
1_004.txt |
AC |
12 ms |
8064 KB |
1_005.txt |
AC |
12 ms |
8064 KB |
1_006.txt |
AC |
12 ms |
8064 KB |
1_007.txt |
AC |
12 ms |
8064 KB |
1_008.txt |
AC |
12 ms |
8064 KB |
1_009.txt |
AC |
12 ms |
8064 KB |
1_010.txt |
AC |
12 ms |
8064 KB |
1_011.txt |
AC |
12 ms |
8064 KB |
1_012.txt |
AC |
12 ms |
8064 KB |
1_013.txt |
AC |
12 ms |
8064 KB |
1_014.txt |
AC |
12 ms |
8064 KB |