思路:

有趣的构造题。

实现:

 #include <bits/stdc++.h>
using namespace std;
char ans[][];
void fillin(int x, int y, char c, int maxy, int cnt)
{
int a = x, b = y;
while (cnt)
{
ans[a][b] = c;
if (b + >= maxy) { a += ; b = y; }
else b += ;
cnt--;
}
}
int main()
{
int a, b, c, d;
while (cin >> a >> b >> c >> d)
{
for (int i = ; i < ; i++)
{
for (int j = ; j < ; j++)
{
ans[i][j] = 'A';
ans[i][j + ] = 'B';
ans[i + ][j] = 'C';
ans[i + ][j + ] = 'D';
}
}
fillin(, , 'B', , b - );
fillin(, , 'C', , c - );
fillin(, , 'D', , d - );
fillin(, , 'A', , a - );
cout << "50 50" << endl;
for (int i = ; i < ; i++)
{
for (int j = ; j < ; j++)
cout << ans[i][j];
cout << endl;
}
}
return ;
}

总结:

对于构造题,要尽量用简单的方法完成任务,不要自己徒增限制条件。

最新文章

  1. Window下python2.7+Apache+mod_wsgi+Django服务器配置
  2. jquery.get()
  3. MySql的连接查询
  4. 回文串+回溯法 URAL 1635 Mnemonics and Palindromes
  5. cocos2d-x 开启深度测试验 实现 遮挡
  6. 设计模式-单键(Singleton)
  7. iOS开发——生成二维码——工具类
  8. JS对undefined,null,NaN判断
  9. lua转让C++书面DLL达到“热更新”
  10. ubuntu14.04 安装 tensorflow
  11. 详解meta标签
  12. MapReduce:并行计算框架
  13. React Native移植原生Android
  14. 使用find命令查找文件
  15. JavaScript异步流程控制的前世今生
  16. 使用 PLSQL 连接 Oracle9i 数据库
  17. antd tree组件文件名换行 + 点击展开时,自动收起同级其他展开目录
  18. PHP抓取网页内容经验总结
  19. WinPE ISO制作
  20. go 切片练习

热门文章

  1. 微信公众号菜单与应用交互session
  2. JavaScript模板引擎使用
  3. 更改NavigationView侧滑菜单文字颜色
  4. javascript之表格节点操作
  5. bzoj1089严格n元树——DP+高精度
  6. DDK编写64位驱动时加入x64汇编的方法
  7. USACO 奶牛排队
  8. 任务49:Identity MVC:Model前端验证
  9. HDU 1713 相遇周期 (最小公倍数)
  10. UVa 11040 Add bricks in the wall (水题递推)