• poj3002


    简单题

    View Code
    #include <iostream>
    #include <cstdlib>
    #include <cstring>
    #include <cstdio>
    using namespace std;

    int n;

    long long gcd(long long x, long long y)
    {
    if (!x || !y)
    return x > y ? x : y;
    for (long long t; t = x % y; x = y, y = t);
    return y;
    }

    void input()
    {
    long long ans = 1;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
    int a;
    scanf("%d", &a);
    ans = ans * a / gcd(ans, a);
    }
    if (ans <= 1000000000)
    printf("%lld\n", ans);
    else
    printf("More than a billion.\n");
    }

    int main()
    {
    //freopen("t.txt", "r", stdin);
    int t;
    scanf("%d", &t);
    while (t--)
    {
    input();
    }
    return 0;
    }

  • 相关阅读:
    切片 Slice
    表单与v-model
    vue-内置指令
    go单元测试
    go异常处理
    设计模式
    django数据库事务
    go interface衍生的插件化处理
    goroutine
    drf之序列化
  • 原文地址:https://www.cnblogs.com/rainydays/p/2203491.html
Copyright © 2020-2023  润新知