fork download
  1. #include <iostream>
  2. #include <cctype>
  3. #include <string>
  4. #include <cmath>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <iomanip>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. ios_base::sync_with_stdio(0);
  13. cin.tie(0);
  14. cout.tie(0);
  15. long long a,b,m;
  16. cin>>a>>b>>m;
  17. long long res=1;
  18. for(long long i=a;i<=b;i++)
  19. {
  20. res*=i%m;
  21. }
  22. //cout<<res<<"\n";
  23. cout<<res%m;
  24. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
1