Advertisement
Dang_Quan_10_Tin

CAU1 HSGHN L9 2015-2016

Dec 24th, 2021
936
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #define task "CAU1"
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. using ll = long long;
  9.  
  10. ll a, b, c;
  11.  
  12. void Read()
  13. {
  14.     cin >> a >> b >> c;
  15. }
  16.  
  17. void Solve()
  18. {
  19.     ll ans(1);
  20.  
  21.     for (; a <= b; ++a)
  22.         ans = ans * a % c;
  23.  
  24.     cout << ans;
  25. }
  26.  
  27. int32_t main()
  28. {
  29.     ios::sync_with_stdio(0);
  30.     cin.tie(0);
  31.     cout.tie(0);
  32.     if (fopen(task ".INP", "r"))
  33.     {
  34.         freopen(task ".INP", "r", stdin);
  35.         freopen(task ".OUT", "w", stdout);
  36.     }
  37.  
  38.     Read();
  39.     Solve();
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement