結果
問題 | No.1164 GCD Products hard |
ユーザー | tonegawa |
提出日時 | 2020-08-15 11:44:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 622 ms |
コンパイル使用メモリ | 73,728 KB |
実行使用メモリ | 71,168 KB |
最終ジャッジ日時 | 2024-04-18 23:57:58 |
合計ジャッジ時間 | 30,668 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,203 ms
62,848 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 1,794 ms
48,000 KB |
testcase_03 | AC | 460 ms
18,816 KB |
testcase_04 | AC | 478 ms
19,584 KB |
testcase_05 | AC | 2,217 ms
56,704 KB |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | AC | 1,787 ms
50,176 KB |
testcase_10 | AC | 445 ms
17,280 KB |
testcase_11 | AC | 2,108 ms
52,992 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 1,537 ms
41,856 KB |
testcase_14 | AC | 1,630 ms
49,408 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 1,921 ms
53,632 KB |
testcase_17 | AC | 2,333 ms
55,168 KB |
testcase_18 | AC | 1,931 ms
50,688 KB |
testcase_19 | AC | 508 ms
20,992 KB |
testcase_20 | AC | 882 ms
28,672 KB |
testcase_21 | TLE | - |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
ソースコード
#include <iostream> #include <vector> #define vll vector<ll> using namespace std; typedef long long int ll; #define P 1000000007 inline ll mpow(ll a, ll b, ll p){ ll ret = 1, num = a; for(;b;){ if(b%2) ret = (ret*num)%p; num = (num*num)%p; b/=2; } return ret; } int main(int argc, char const *argv[]) { ll a, b, n, ans = 1; scanf("%lld %lld %lld", &a, &b, &n); ll cnt[b+1]; for(int g=b;g>=2;g--){ ll tmp = (b/g) - ((a-1)/g); cnt[g] = mpow(tmp, n, P-1); for(int k=2*g;k<=b;k+=g) { cnt[g] = (cnt[g] - cnt[k]); if(cnt[g]<0) cnt[g] += P-1; } ans = (ans * mpow(g, cnt[g], P))%P; } printf("%lld\n", ans); }