Submission #41232


ソースコード

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
#include <cstdio>
#define max(a,b) ((a)>(b) ? (a) : (b))
using ll = long long;
ll GCD(ll x, ll y) { return (y == 0)? x : GCD(y, x%y); }
ll LCM(ll x, ll y) { return (x / GCD(x,y) * y); }
ll LCM(ll x, ll y, ll z) { return LCM(LCM(x,y), z); }
int main()
{
int N;
ll a[100], maxv=0;
scanf("%d", &N);
for (int i=0; i<N; ++i) scanf("%lld", a+i);
for (int i=0; i<N; ++i)
for (int j=i+1; j<N; ++j)
for (int k=j+1; k<N; ++k)
maxv = max(maxv, LCM(a[i], a[j], a[k]));
printf("%lld\n", maxv);
return 0;
}

ステータス

項目 データ
問題 0973 - 最大最小公倍数
ユーザー名 Arumakan_ei1727
投稿日時 2018-08-11 19:49:58
言語 C++14
状態 Accepted
得点 1
ソースコード長 594 Byte
最大実行時間 61 ms
最大メモリ使用量 724 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample1 AC 30 ms 480 KB
1
input-sample2 AC 25 ms 724 KB
1
input-sample3 AC 21 ms 584 KB
1
input01 AC 26 ms 692 KB
1
input02 AC 23 ms 548 KB
1
input03 AC 19 ms 536 KB
1
input04 AC 48 ms 648 KB
1
input05 AC 57 ms 508 KB
1
input06 AC 61 ms 492 KB
1
input07 AC 51 ms 352 KB
1
input08 AC 29 ms 336 KB
1
input09 AC 34 ms 452 KB
1
input10 AC 52 ms 568 KB
1
input11 AC 42 ms 548 KB
1
input12 AC 34 ms 532 KB
1