Advertisement
Anik_Akash

n! comnination for minhaj

Aug 14th, 2021
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. long long int factoril(int n){
  4.      long long int ans=1;
  5.      for(int i=1; i<=n; i++){
  6.           ans*=i;
  7.      }
  8.      return ans;
  9. }
  10. int main(){
  11.    
  12.      int n, cnt=0;
  13.      while(scanf("%d",&n)==1){
  14.           if(n>0)cnt++;
  15.       }
  16.  
  17.      long long int hor = factoril(cnt);
  18.      long long int lov = factoril(cnt-2);
  19.      printf("%d\n", hor/(2*lov));
  20.    return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement