文章

113

粉丝

1

获赞

869

访问

38.5k

头像
n个数的最小公倍数 题解:c++
P3684
发布于2026年3月20日 17:32
阅读数 262

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

bool isP(int temp){
    for(int i = 2; i < temp ; i++){
        if(temp % i == 0) return false;
    }
    return true;
}
int gcd(int x,int y){
    if(x > y) swap(x,y);
    for(int i = 2 ; i <= x; i++){
        if(x%i == 0 && y%i==0) return i; 
    }
    return 1;
}
int main(){
    int n;
    while(cin >> n){
        vector<long long> v;
        for(int i = 0 ; i < n; i++){
            int t;
            cin >> t;
            v.push_back(t);
        }
        int res;
        for(int i = 0 ; i < n - ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发