結果
| 問題 | No.1791 Repeat Multiplication | 
| コンテスト | |
| ユーザー |  Nachia | 
| 提出日時 | 2021-12-20 00:13:33 | 
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 118 ms / 3,000 ms | 
| コード長 | 736 bytes | 
| コンパイル時間 | 2,425 ms | 
| コンパイル使用メモリ | 110,452 KB | 
| 最終ジャッジ日時 | 2025-01-27 04:01:22 | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
int N,Q;
vector<i64> dp1;
int main() {
    cin >> N >> Q;
    dp1.assign(N+1, 0);
    dp1[1] = 1;
    for(i64 i=1; i<=N; i++) for(i64 j=i*2; j<=N; j+=i) dp1[j] += dp1[i];
    for(i64 i=1; i<=N; i++) dp1[i] += dp1[i-1];
    rep(i,Q){
        int x; cin >> x;
        i64 ans = (dp1[x] - dp1[x-1]) * dp1[N/x];
        cout << ans << "\n";
    }
    return 0;
}
struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
            
            
            
        