#include <bits/stdc++.h> using namespace std ; #define boost ios :: sync_with_stdio ( 0 ); cin . tie ( 0 ) #define ll long long int main (){ boost ; ll t ; cin >> t ; while ( t --) { ll n ; cin >> n ; string seq ; cin >> seq ; ll count { 0 }; for ( int i = 0 ; i < seq . size (); i ++){ if ( seq [ i ] ==...
#include <bits/stdc++.h> using namespace std ; int fact ( int n){ //1st step Base Case if (n== 0 ){ return 1 ; } int smallans = fact(n- 1 ) ; // 2nd step Assumption Recursive Case int ans = n*smallans ; //3rd step Calculation return ans ; } int main (){ int n ; cin >> n ; cout << fact(n) << ' \n ' ; return 0 ; }
Comments
Post a Comment