P5436 【XR-2】缘分

题目大意

求两个不超过 \(n\) 的正整数的最小公倍数的最大值。

前置知识

  • 最小公倍数

题解

略...

注意特判 \(n = 1\)

代码

#include <bits/stdc++.h>
using namespace std;

int main() {
    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        if (n == 1) {
            puts("1");
            continue;
        }
        cout << 1ll * n * (n - 1) << endl;
    } 
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/xht37/p/11107868.html
P2P