Advertisement
Dang_Quan_10_Tin

GACANDY

May 30th, 2022
1,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #define task "GACANDY"
  2. #include <iostream>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. using ll = long long;
  8. using ld = long double;
  9.  
  10. constexpr int N = 1e5 + 5;
  11. constexpr ll mod = 25012003;
  12. ll n;
  13.  
  14. void Read()
  15. {
  16.     cin >> n;
  17. }
  18.  
  19. ll Pow(ll a, ll b)
  20. {
  21.     ll ans(1);
  22.  
  23.     for (; b; b >>= 1)
  24.     {
  25.         if (b & 1)
  26.             ans = ans * a % mod;
  27.         a = a * a % mod;
  28.     }
  29.  
  30.     return ans;
  31. }
  32.  
  33. void Solve()
  34. {
  35.     ll gt(1);
  36.  
  37.     for (int i = 1; i < 25012003; ++i)
  38.         gt = gt * i % mod;
  39.  
  40.     gt = Pow(gt, n / mod);
  41.  
  42.     n %= mod;
  43.  
  44.     for (int i = 1; i <= n; ++i)
  45.         gt = gt * i % mod;
  46.  
  47.     cout << gt;
  48. }
  49.  
  50. int32_t main()
  51. {
  52.     ios_base::sync_with_stdio(0);
  53.     cin.tie(0);
  54.     cout.tie(0);
  55.  
  56.     if (fopen(task ".INP", "r"))
  57.     {
  58.         freopen(task ".INP", "r", stdin);
  59.         freopen(task ".OUT", "w", stdout);
  60.     }
  61.  
  62.     Read();
  63.     Solve();
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement