SHARE
TWEET

Untitled

a guest Feb 15th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     for (int i = 0; i < 3; ++i)
  8.     {
  9.         long long n = 0;
  10.         long long m = 0;
  11.  
  12.         scanf("%lli", &n);
  13.         scanf("%lli", &m);
  14.  
  15.         long long ans = 1;
  16.  
  17.         for (long long i = 1; i < n && ans != 0; ++i)
  18.             ans = (ans * (i + 1)) % m;
  19.  
  20.         printf("%lli\n", ans);
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top