Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- const int N = 1e5 + 5;
- int a[N] , cnt[N];
- // t <= 0 berk
- // 1 <= t <= 99 maye
- // t >= 100 qaz
- string fi(int t){
- if(t <= 0)
- return "berk";
- if(t <= 99)
- return "maye";
- return "qaz";
- }
- // n! = 1 * 2 * 3 * . . . (n - 1) * n = (n - 1)! * n
- int f(int n){
- if(n == 0)
- return 1;
- return n * f(n - 1);
- }
- int sum(int a , int b){
- return a + b;
- }
- /*
- recursive
- f(5) = 5 * f(4) = 5 * 24 = 120
- f(4) = 4 * f(3) = 4 * 6 = 24
- f(3) = 3 * f(2) = 3 * 2 = 6
- f(2) = 2 * f(1) = 2 * 1 = 2
- f(1) = 1 * f(0) = 1 * 1 = 1
- f(0) = 1
- */
- bool parity(int n){
- return n % 2 == 0;
- }
- void solve(){
- int n;
- cin >> n;
- if(n < 0)
- return ;
- cout << f(n) << '\n';
- }
- signed main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- while(t--)
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement