-
Notifications
You must be signed in to change notification settings - Fork 3
/
lightoj 1024.cpp
96 lines (70 loc) · 3.11 KB
/
lightoj 1024.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
///***Bismillahir Rahmanir Rahim***///
///*********************************///
///******Ashraful Haque Toni********///
///********Dept. of CSE,JnU*********///
///email:[email protected]///
///*******contact:01640690531*******///
///*********************************///
#include<bits/stdc++.h>
using namespace std;
#define ash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define I1(n) cin>>n
#define I2(m,n) cin>>m>>n;
#define I3(m,n,o) cin>>m>>n>>o;
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%I64d",&n);
#define sc2(m,n) scanf("%d%d",&m,&n);
#define sc2l(m,n) scanf("%I64d%I64d",&m,&n);
#define pf printf
#define f(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define ar_input(a,n) f(i,n)cin>>a[i];
#define ve_input(v,n) f(i,n){ll m;cin>>m,v.pb(m);}
#define Max INT_MAX
#define Min INT_MIN
#define pi acos(-1.0)
#define Mem(a,val) memset(a,val,sizeof(a));
#define asort(a,n) sort(a,a+n)
#define vsort(v) sort(v.begin(),v.end())
#define fr(i,s,e) for(ll i=s;i<=e;i++)
#define ff first
#define ss second
#define vec vector<ll>
#define pai pair<ll,ll>
#define Map map<ll,ll>
#define mod 1000000007
#define ll long long
#define PC(i) cout<<"Case "<<i<<": ";
///template function///
ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
///ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
///ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
///ll num_coprime(ll n){ll ans=n;for(ll i=2;i*i<=n; i++){if(n%i==0){while(n%i==0)n/=i;ans-=ans/i;}}if(n>1)ans-=ans/n;return ans;}
///set<ll>s;void divisors(ll n){f1(i,sqrt(n))if(n%i==0){s.insert(i);s.insert(n/i);}}
///*********************************************start***********************************************///
int main()
{
//freopen("1024.txt","r",stdin);
ash;
int t;
I1(t);
f1(i,t)
{
int n;
I1(n);
unsigned ll a[n],re;
f(j,n)cin>>a[j];
re=LCM(a[0],a[1]);
for(int ii=2;ii<n;ii++)
{
re=LCM(re,a[ii]);
}
PC(i);
cout<<re<<endl;
}
return 0;
}
///**********************************************end*************************************************///