Codeforces Round #235 (Div. 2)C、Team
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,m; cin >> n >> m; if(n > (m + 1) || m > (n + 1)*2 ) cout<< -1; else if( n>= m) { for(int i = 0; i < m; ++ i) cout<<"01"; for(int i = m; i < n; ++ i) cout<<"0"; }else if(n*2>=m){ for(int i = 0; i< m - n; ++ i) cout<<"110"; for(int i =m-n; i < n; ++ i ) cout<< "10"; }else{ for(int i = 0 ; i < n ; ++ i) cout<<"110"; for(int i = 0 ; i< m-2*n; ++ i) cout<<"1"; } cout<<endl; }