Advertisement
Shiam7777777

Untitled

Mar 15th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  4. #define ll long long
  5. #define ld double
  6. #define llu long long unsigned
  7.  
  8. int main()
  9. {
  10.     fast;
  11.     int t;
  12.     cin>>t;
  13.     for( int c = 1 ; c <= t ; c++ )
  14.     {
  15.         cout<<"Case "<<c<<": ";
  16.         int n , k;
  17.         cin>>n>>k;
  18.         if( n < k )
  19.         {
  20.             cout<<0<<endl;
  21.             continue;
  22.         }
  23.         llu ans = 1;
  24.         for( int i = 1 ; i <= k ; i++ )
  25.         {
  26.             ans *= pow( n - i + 1 , 2 );
  27.         }
  28.         for( int i = 1 ; i <= k ; i++ )
  29.             ans /= i;
  30.         cout<<ans<<endl;
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement