Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<algorithm>
  4. #include<cmath>
  5.  
  6. using namespace std;
  7.  
  8. int n,sol,t;
  9.  
  10. int rjesenje(int x){
  11.  
  12. if(x == 1){
  13.  
  14. return sol + 1;
  15. }
  16. else{
  17.  
  18. sol = x * x + rjesenje(x-1);
  19. }
  20.  
  21. sol = 0;
  22. }
  23.  
  24.  
  25.  
  26. int main(){
  27. scanf("%d",&t);
  28.  
  29. for(int i = 0;i < t;i++){
  30.  
  31. scanf("%d",&n);
  32.  
  33. printf("%d\n",rjesenje(n));
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement