Problem 2721 --Structured Program I - Print a Chessboard

2721: Structured Program I - Print a Chessboard

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $622$ 正确数量 $505$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL

Print a Chessboard 

Draw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.

#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#

Note that the top left corner should be drawn by '#'.

The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space. 

The input ends with two 0 (when both H and W are zero).

For each dataset, print the chessboard made of '#' and '.'. 

Print a blank line after each dataset.

3 4
5 6
3 3
2 2
1 1
0 0
#.#.
.#.#
#.#.

#.#.#.
.#.#.#
#.#.#.
.#.#.#
#.#.#.

#.#
.#.
#.#

#.
.#

#
1 ≤ H, W ≤ 300

推荐代码 查看2721 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 清泉流响 647989 2020-11-06 00:28:14
内存最少[$0 $KB] DCDOTA 649964 2020-11-08 14:59:05
第一AC 刘成健 315118 2018-11-16 22:13:40
第一挑战 刘成健 315118 2018-11-16 22:13:40

赛题来源/所属竞赛 会津大学《C++ Programming I》 C++程序设计(入门)

竞赛编号 竞赛名称 竞赛时间 访问比赛
1776 2023-2024-1学期《C语言程序设计》:循环结构II【23计算机】 2023-10-30 00:00:00 请登录
1717 2022-2023-1学期《C语言程序设计》:循环结构II【22计算机】 2022-11-01 08:00:00 请登录
1661 2021-2022-1学期《C语言程序设计》:循环结构II【21计算机】 2021-11-01 00:00:00 请登录
1553 2020-2021-1学期《Python程序设计》多重循环II【20数据科学12班】 2020-11-08 10:00:00 请登录
1565 2020-2021-1学期《C语言程序设计》:循环结构II【20计算机12345】 2020-10-30 19:00:00 请登录