結果
問題 | No.1164 GCD Products hard |
ユーザー | chocorusk |
提出日時 | 2020-08-11 23:57:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,146 bytes |
コンパイル時間 | 1,220 ms |
コンパイル使用メモリ | 126,220 KB |
実行使用メモリ | 81,792 KB |
最終ジャッジ日時 | 2024-04-17 17:55:00 |
合計ジャッジ時間 | 41,813 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,666 ms
58,312 KB |
testcase_01 | AC | 2,150 ms
65,224 KB |
testcase_02 | AC | 1,395 ms
47,872 KB |
testcase_03 | AC | 349 ms
18,816 KB |
testcase_04 | AC | 354 ms
19,584 KB |
testcase_05 | AC | 1,761 ms
58,312 KB |
testcase_06 | AC | 2,230 ms
68,424 KB |
testcase_07 | AC | 2,270 ms
72,268 KB |
testcase_08 | AC | 2,130 ms
70,724 KB |
testcase_09 | AC | 1,361 ms
49,920 KB |
testcase_10 | AC | 350 ms
17,152 KB |
testcase_11 | AC | 1,561 ms
52,864 KB |
testcase_12 | AC | 2,276 ms
67,908 KB |
testcase_13 | AC | 1,123 ms
41,856 KB |
testcase_14 | AC | 1,177 ms
49,152 KB |
testcase_15 | AC | 2,341 ms
72,264 KB |
testcase_16 | AC | 1,490 ms
53,504 KB |
testcase_17 | AC | 1,743 ms
54,912 KB |
testcase_18 | AC | 1,485 ms
50,560 KB |
testcase_19 | AC | 396 ms
20,608 KB |
testcase_20 | AC | 660 ms
28,672 KB |
testcase_21 | TLE | - |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | AC | 2,418 ms
81,792 KB |
testcase_24 | TLE | - |
testcase_25 | AC | 1 ms
6,944 KB |
testcase_26 | AC | 2 ms
6,944 KB |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 1 ms
6,940 KB |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair<int, int> P; const ll MOD=1e9+7; ll powmod(ll a, ll k, ll mod){ ll ap=a, ans=1; while(k){ if(k&1){ ans*=ap; ans%=mod; } ap=ap*ap; ap%=mod; k>>=1; } return ans; } ll inv(ll a, ll mod){ return powmod(a, mod-2, mod); } ll c[10000010]; int main() { int a, b, n; cin>>a>>b>>n; for(int d=b; d>=1; d--){ c[d]=powmod(b/d-(a-1)/d, n, MOD-1); for(int i=2*d; i<=b; i+=d){ c[d]+=MOD-1-c[i]; if(c[d]>=MOD-1) c[d]-=(MOD-1); } } ll ans=1; for(int i=1; i<=b; i++){ (ans*=powmod(i, c[i], MOD))%=MOD; } cout<<ans<<endl; return 0; }