#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif
/************ for topcoder by zz1215 *******************/
#define FOR(i,a,b) for( int i = (a) ; i <= (b) ; i ++)
#define FFF(i,a) for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a,b) for( int i = (a) ; i >= (b) ; i --)
#define S64(a) scanf(in64,&a)
#define SS(a) scanf("%d",&a)
#define LL(a) ((a)<<1)
#define RR(a) (((a)<<1)+1)
#define pb push_back
#define CL(Q) while(!Q.empty())Q.pop()
#define MM(name,what) memset(name,what,sizeof(name))
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-9;
const double pi = acos(-1.0);
const int maxn = 15001;
i64 gcd(i64 _a, i64 _b)
{
if (!_a || !_b)
{
return max(_a, _b);
}
i64 _t;
while ((_t = _a % _b))
{
_a = _b;
_b = _t;
}
return _b;
}
struct zz
{
int x;
int t;
bool operator == (const zz & cmp) const
{
return x == cmp.x;
}
}zx;
vector<int>p;
int T;
int x[200];
int y[200];
int s[maxn];
int tot;
bool isp(int x)
{
for(int i=0;p[i]*p[i]<=x;i++) if(x%p[i] == 0)
{
return false;
}
return true;
}
void init()
{
p.clear();
p.pb(2);
for(int i=3;i<100011;i++)
{
if(isp(i))
{
p.pb(i);
}
}
return ;
}
int find(int x,int n)
{
int re = 0;
while(p[x]<=n)
{
n /=p[x];
re += n;
}
return re;
}
int main()
{
init();
while(cin>>T)
{
tot = 0;
for(int i=1;i<=T;i++)
{
cin>>x[i]>>y[i];
if(x[i]>tot)
{
tot = x[i];
}
}
int temp;
int t2;
for(int i=0;p[i]<=tot;i++)
{
t2 = inf;
for(int u=1;u<=T;u++)
{
temp = find(i,x[u]) - find(i,x[u]-y[u]) - find(i,y[u]);
t2 = min(t2,temp);
if(t2==0)
{
break;
}
}
s[i] = t2;
}
i64 ans = 1;
for(int i=0;p[i]<=tot;i++)
{
for(int u=1;u<=s[i];u++)
{
ans*=p[i];
}
}
cout<<ans<<endl;
}
return 0;
}
fzu1753 Another Easy Problem
最新推荐文章于 2019-09-16 21:55:33 发布