Advertisement
yuawn

algo2017_week11_power_problem

Dec 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define fo(n) for(int i=0;i<n;i++)
  4. #define fos(o,n) for(int i=o;i<=n;i++)
  5.  
  6. int main(){
  7.    
  8.     int n;
  9.    
  10.     while( cin >> n && n ){
  11.         int ans = 1;
  12.         bool no = 1;
  13.         while( no ){
  14.             map<int,bool> mp;
  15.             int t = ans - 1 , closed = 0;
  16.             bool p = 0;
  17.             while( closed < n ){
  18.                 fo( n ){
  19.                     if( p ) break;
  20.                     if( mp[i] ) continue;
  21.                     ++t;
  22.                     if( t == ans ) {
  23.                         mp[i] = 1 , t = 0 , ++closed;
  24.                         if( i == 12 && closed < n ) p = 1;
  25.                     }
  26.                 }
  27.                 if( p ) break;
  28.             }
  29.             if(p) ++ans;
  30.             else no = 0;
  31.         }
  32.         cout << ans << endl;
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement