AtCoder Beginner Contest 052

Submission #1588459

Source codeソースコード

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する
const int mod = 1000000007;


int main() {
    int N;
    cin >> N;

    bool prime[1001];
    REP(i, 0, 1001) {
        prime[i] = true;
    }
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i <= 1000; i++) {
        if (prime[i]) {
            for (int j = i * 2; j <= 1000; j += i) {
                prime[j] = false;
            }
        }
    }
    vector<int> primes;
    REP(i,0,1001){
        if(prime[i]) primes.push_back(i);
    }

    vector<int> pows(primes.size());
    for(int i = 0; i < primes.size(); i++){
        pows[i] = 1;
        for(int j = 1; (N/(int)pow(primes[i],j)) > 0; j++){
            pows[i] += N/pow(primes[i],j);
        }
    }

    ll ret = 1;
    REP(i,0,primes.size()){
        ret = ((ll)ret * (ll)pows[i]) % (ll)mod;
    }

    cout << ret << endl;


    return 0;
}

Submission

Task問題 C - Factors of Factorial
User nameユーザ名 homesentinel
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 300
Source lengthソースコード長 2114 Byte
File nameファイル名
Exec time実行時間 1 ms
Memory usageメモリ使用量 256 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 300 / 300 sample_01.txt,sample_02.txt,sample_03.txt,subtask_1_certain_01.txt,subtask_1_certain_02.txt,subtask_1_certain_03.txt,subtask_1_certain_04.txt,subtask_1_rand_01.txt,subtask_1_rand_02.txt,subtask_1_rand_03.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_certain_01.txt AC 1 ms 256 KB
subtask_1_certain_02.txt AC 1 ms 256 KB
subtask_1_certain_03.txt AC 1 ms 256 KB
subtask_1_certain_04.txt AC 1 ms 256 KB
subtask_1_rand_01.txt AC 1 ms 256 KB
subtask_1_rand_02.txt AC 1 ms 256 KB
subtask_1_rand_03.txt AC 1 ms 256 KB