terdenan

Problem E #362

Sep 25th, 2016
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4. #include <algorithm>
  5. #include <stack>
  6. #include <string>
  7. #include <vector>
  8. #include <map>
  9. #include <queue>
  10.  
  11. #define ll long long
  12. #define f first
  13. #define s second
  14. #define pb push_back
  15. #define mp make_pair
  16.  
  17. using namespace std;
  18.  
  19. int n, cnt[100010], b[100010], i;
  20. double answ[100010];
  21. vector <int> a[100010];
  22.  
  23. int cnt1, cnt2;
  24.  
  25. void dfs(int lvl, int v)
  26. {
  27.     if (lvl == i)
  28.     {
  29.         if (v == 1)
  30.         {
  31.             cnt1++;
  32.             cnt2++;
  33.         }
  34.         else cnt2++;
  35.     }
  36.     else
  37.     {
  38.         if (v == 1)
  39.         {
  40.             dfs(lvl + 1, 0);
  41.             dfs(lvl + 1, 0);
  42.         }
  43.         else
  44.         {
  45.             dfs(lvl + 1, 1);
  46.             dfs(lvl + 1, 0);
  47.         }
  48.     }
  49. }
  50.  
  51. void f()
  52. {
  53.     for (int j = 2; j <= cnt1; j++)
  54.     {
  55.         if (cnt1 % 2 == 0 && cnt2 % 2 == 0)
  56.         {
  57.             cnt1 /= 2;
  58.             cnt2 /= 2;
  59.         }
  60.     }
  61. }
  62.  
  63. int main()
  64. {
  65.     for (i = 1; i <= 50; i++)
  66.     {
  67.         cnt1 = 0;
  68.         cnt2 = 0;
  69.         dfs(1, 1);
  70.         f();
  71.         cout << cnt1 << " " << cnt2 << endl;
  72.     }
  73.     return 0;      
  74. }
Add Comment
Please, Sign In to add comment