Translate

Views

Tuesday, March 12, 2024

Codeforces Round 930 (Div. 2): A - Shuffle Party / Solution

Solution:

2 1 / 1 in 2

3 1 / 1 in 2

4 2 / 1 in 4

5 1 / 1 in 4

6 3 / 1 in 4

7 1 / 1 in 4

8 4 / 1 in 8

9 3 / 1 in 8

10 5 / 1 in 8

11 1

12 6

13 1

14 7

15 5

16 8

17 1

18 9

19 1

20 10


  1. #include<bits/stdc++.h>
  2. #define int long long
  3. #define oo LLONG_MAX
  4. #define FOR(i, a, b) for(int i=a; i<=b; i++)
  5. using namespace std;
  6.  
  7. const int N= 1000111;
  8. int t, n;
  9. int a[N];
  10.  
  11. void solve(){
  12.  
  13. cin >> n;
  14. int x= 0;
  15. while(pow(2, x) <= n){
  16. x++;
  17. }
  18. cout<<(int)pow(2,x-1)<<"\n";
  19. }
  20.  
  21. int32_t main(){
  22.  
  23. ios::sync_with_stdio(false);
  24. cin.tie(nullptr);
  25.  
  26. cin >> t;
  27.  
  28. while(t--){
  29.  
  30. solve();
  31. }

No comments: