Submission #928311
Source Code Expand
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<ll,int>
#define Lson L, mid, ls[rt]
#define Rson mid+1, R, rs[rt]
#define sys system("pause")
const int maxn=1e5+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
inline ll read()
{
ll x=0;int f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int n,m,k,t;
ll a,b,pa,pb;
int main()
{
int i,j;
scanf("%d",&n);
rep(i,1,n)
{
scanf("%lld%lld",&a,&b);
if(i==1)pa=a,pb=b;
else
{
j=max(pa%a==0?pa/a:pa/a+1,pb%b==0?pb/b:pb/b+1);
a*=j,b*=j;
pa=a,pb=b;
}
}
printf("%lld\n",a+b);
//system("Pause");
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:46:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:49:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld",&a,&b);
^
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 |
AC |
2 ms |
256 KB |
0_001.txt |
AC |
2 ms |
256 KB |
0_002.txt |
AC |
2 ms |
256 KB |
1_003.txt |
AC |
2 ms |
256 KB |
1_004.txt |
AC |
2 ms |
256 KB |
1_005.txt |
WA |
2 ms |
256 KB |
1_006.txt |
WA |
2 ms |
256 KB |
1_007.txt |
WA |
2 ms |
256 KB |
1_008.txt |
WA |
2 ms |
256 KB |
1_009.txt |
WA |
2 ms |
256 KB |
1_010.txt |
WA |
2 ms |
256 KB |
1_011.txt |
WA |
2 ms |
256 KB |
1_012.txt |
WA |
2 ms |
256 KB |
1_013.txt |
WA |
3 ms |
256 KB |
1_014.txt |
AC |
3 ms |
256 KB |