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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.