Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cstring>
- #include<algorithm>
- #include<cmath>
- using namespace std;
- int n,sol,t;
- int rjesenje(int x){
- if(x == 1){
- return sol + 1;
- }
- else{
- sol = x * x + rjesenje(x-1);
- }
- sol = 0;
- }
- int main(){
- scanf("%d",&t);
- for(int i = 0;i < t;i++){
- scanf("%d",&n);
- printf("%d\n",rjesenje(n));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement