Codeforces 1348A. Phoenix and Balance Solution

Solution in c++:
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,sum,i,j,t;
  6. cin>>t;
  7. for(j=1; j<=t; j++)
  8. {
  9. sum=0;
  10. cin>>a;
  11. {
  12. for(i=1; i<=a/2; i++)
  13. {
  14. sum=sum+pow(2,i);
  15. }
  16. cout<<sum<<endl;
  17. }
  18. }
  19. }
  20.  

2 comments:

  1. Wrong code, read the problem again. You just added all of them, it's wrong.

    ReplyDelete
    Replies
    1. Buddy, you got screws loose. This solution is probably too good for your brain to think.

      Delete

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.