Submission #1513755


Source Code Expand

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
typedef int64_t ll;
typedef std::vector<ll> vll;
using namespace std;
struct Math {
    // エラトステネスの篩、O(n log2 log2 n)
    template<typename T> std::map<T, bool> sieve(T n) {
        std::map<T, bool> res;
        res[0] = false;
        res[1] = false;
        for (size_t i = 2; i <= (size_t)n; i++) {
            res[i] = true;
        }
        // size_t p = 0;
        for (size_t i = 2; i <= (size_t)n; i++) {
            if (res[i]) {
                // prime[p++] = i;
                for (size_t j = 2 * i; j <= (size_t)n; j += i) {
                    res[j] = false;
                }
            }
        }
        return res;
    }
};
struct Solution {
    Math m;
    void solve(std::istream& in, std::ostream& out) {
        auto p = m.sieve(100000);
        int j = 0;
        bool ok = true;
        vll ans = {735134400,698377680,551350800,367567200,294053760,245044800,183783600,147026880,122522400,110270160,73513440,61261200,43243200,36756720,32432400,21621600,17297280,14414400,10810800,8648640,7207200,6486480,4324320,3603600,2882880,2162160,1441440,1081080,720720,665280,554400,498960,332640,277200,221760,166320,110880,83160,55440,50400,45360,27720,25200,20160,15120,10080,7560,5040,2520,1680,1260,840,720,360,240,180,120,60,48,36,24,12,6,4,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
        while (ok) {
            j = 0;
            ok = false;
            rep(i, 100001) {
                if (!p[i]) continue;
                if (ans[j] * i <= 1000000000) {
                    ans[j] *= i;
                    ok = true;
                }
                else {
                    j++;
                    if (j == 100) break;
                    i--;
                }
            }
        }
        rep(i, 100) {
            out << ans[i] << std::endl;
        }
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}

Submission Info

Submission Time
Task A - 約数をたくさんつくろう!
User masakt
Language C++14 (GCC 5.4.1)
Score 19912
Code Size 2326 Byte
Status AC
Exec Time 71 ms
Memory 4992 KB

Judge Result

Set Name test_01
Score / Max Score 19912 / 100000
Status
AC × 1
Set Name Test Cases
test_01 noinput.txt
Case Name Status Exec Time Memory
noinput.txt AC 71 ms 4992 KB