fork download
  1. #include <stdio.h>
  2. #include<math.h>
  3. int main(void) {
  4. long int d,X,sum,N,e=0,f=1,a=1,b=1,c;
  5. scanf("%ld",&N);
  6. scanf("%ld",&X);
  7. if(a==1 && b==1)
  8. {
  9. c=a*b;
  10. }else for(d=0;d<=N;d+=2)
  11. {sum+=(pow(-1,e)*pow(X,f));
  12. e++;
  13. f+=2;
  14. long int n=0;
  15. for(a=f;a<=(2*n+1);a+=2)
  16. {
  17. c=a*b;
  18. b=c;
  19. n++;
  20. }
  21. }
  22. printf("%ld\n",c);
  23. printf("%ld ",sum);
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 10304KB
stdin
4
5
stdout
1
0