先求0,1的个数,然后贪心输出01即可

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a,b,c,d,tot1,tot0;
int main(){
cin>>a>>b>>c>>d;
//a=0,b=0的情况优先考虑
if(!a && !b && !c && !d){
puts("");return ;
}
//判断a=0的情况
if(!a&&!b&&!c)tot0=;else tot0=;
//判断d==0的情况
if(!d&&!b&&!c)tot1=;else tot1=; if(a)tot0=(int)(sqrt(a*))+;
if(d)tot1=(int)(sqrt(d*))+; if(tot0*(tot0-)/!=a || tot1*(tot1-)/!=d || tot0*tot1!=b+c){
puts("Impossible");return ;
} while(b){
if(b>=tot1){
cout<<;
b-=tot1;
tot0--;
}
else if(c>=tot0){
cout<<;
c-=tot0;
tot1--;
}
}while(tot1)cout<<,tot1--;
while(tot0)cout<<,tot0--; }

最新文章

  1. [转载]两个半小时学会Perl
  2. XPah学习
  3. wpf msdn在线地址http://msdn.microsoft.com/zh-cn/library/ms752324(v=vs.110).aspx
  4. Socket 学习(三).2 udp 穿透 服务端 与 客户端 通讯
  5. Hadoop -YARN 应用程序设计概述
  6. HTML中判断手机是否安装某APP,跳转或下载该应用
  7. angular router ui bug !
  8. CSS3总结一:border(边框)
  9. 解决hash冲突的三个方法
  10. KFCM算法的matlab程序
  11. 推荐10本C#编程的最佳书籍
  12. PGAdmin 4使用笔记
  13. springboot-28-security(一)用户角色控制
  14. 子元素scroll父元素容器不跟随滚动JS实现
  15. idea 设置
  16. Linux命令-目录处理命令:mv
  17. CXCommon.h工具类
  18. Linux安装vsftpd
  19. 关于PDO取得结果集的数据类型为string的问题
  20. CSS知识之 background-position 用法详细介绍

热门文章

  1. QTcpSocket学习
  2. SysTick功能总结
  3. BZOJ 3207: 花神的嘲讽计划Ⅰ(莫队+哈希)
  4. [NOIP模拟测试38]题解
  5. 远程桌面发生身份验证错误,要求的函数不受支持【WIN10家庭】或【专业版】--解决办法
  6. .NET Core开源组件:后台任务利器之Hangfire 转载 https://www.cnblogs.com/chenug/p/6655636.html
  7. Newline required at end of file but not found
  8. 阻抗匹配 及 SI9000 使用
  9. HDU4578-Transformation-线段树的加、乘、变、次方操作
  10. Scrapy框架: pipelines.py设置