Submission #41234


ソースコード

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
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <algorithm>
#include <vector>
//#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <numeric>
using namespace std;
#define elif else if
#define echo cout <<
#define read cin >>
#define fin << '\n'
#define finn cout << '\n'
#define forin(i, n) for ( int i = 0; i < n; i++ )
#define zu >>
#define und <<
#define alles(obj) obj.begin(), obj.end()
#define bash push_back
typedef long long llong;
typedef bool boolean;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
boolean canMove(int x,int y,int w,int h){return (x>=0&&y>=0&&x<w&&y<h);};
const int INF = 1 << 29;
int main(){
cin.tie(0); ios::sync_with_stdio(false);
llong ans;
int n;
vector<llong> a;
read n;
forin ( i, n ) {
llong b;
read b;
a.bash(b);
}
llong tmp = -1;
for ( int i = 0; i < n; i++ ) {
for ( int j = i+1; j < n; j++ ) {
llong firstLCM = lcm(a[i], a[j]);
for ( int k = j+1; k < n; k++ ) {
tmp = max( tmp, lcm(firstLCM, a[k]) );
}
}
}
echo tmp fin;
return 0;
}

ステータス

項目 データ
問題 0973 - 最大最小公倍数
ユーザー名 r1825
投稿日時 2018-08-11 20:24:18
言語 C++17
状態 Accepted
得点 1
ソースコード長 1353 Byte
最大実行時間 47 ms
最大メモリ使用量 744 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample1 AC 22 ms 480 KB
1
input-sample2 AC 19 ms 436 KB
1
input-sample3 AC 16 ms 396 KB
1
input01 AC 17 ms 480 KB
1
input02 AC 18 ms 572 KB
1
input03 AC 22 ms 664 KB
1
input04 AC 35 ms 496 KB
1
input05 AC 35 ms 452 KB
1
input06 AC 43 ms 540 KB
1
input07 AC 44 ms 500 KB
1
input08 AC 24 ms 584 KB
1
input09 AC 26 ms 660 KB
1
input10 AC 47 ms 744 KB
1
input11 AC 33 ms 700 KB
1
input12 AC 23 ms 652 KB
1