wenbao与cf010101001010101

小垃圾代码

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 #define ll  long long 
 4 ll a, b, c, d, x, ax, dx, flag = 0, num = 0;
 5 int main(){
 6     cin>>a>>b>>c>>d;
 7     // cout<<num<<endl;
 8      if( a == 0 && d == 0&&c==0&&b==0 ) { cout <<0 <<endl; return 0; } 
 9     for( int i = 1; ; i ++ ){
10         x = i * ( i - 1 ) / 2;
11         // cout<<x<<endl;
12         if( x == a ) ax = i, num ++; 
13         if( x == d ) dx = i, num ++;
14         if( num == 2 ) {flag=1;break; }
15         if( x > max( a, d ) ) break;
16     }
17      // cout<<num<<endl;
18     if( ! flag ) cout<<"Impossible"<<endl;
19     else{
20         if( a == 0 &&c==0&&b==0 ) ax = 0;
21         if( d == 0 &&c==0&&b==0) dx = 0;
22           // cout << ax << " " << dx << endl;
23         if( b + c == ax * dx ){
24             num = ax + dx;
25         while( num -- ){
26                 if( b >= dx ) { cout<<0; b -= dx; ax --; }
27                 else { cout<< 1; dx --; }
28             }
29         }
30         
31         else cout <<"Impossible" <<endl;
32     }
33 }

 

 

 

只有不断学习才能进步!

 

转载于:https://www.cnblogs.com/wenbao/p/5811704.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值