nyoj880还是打印菱形
发布日期:2021-06-29 11:14:03
浏览次数:3
分类:技术文章
本文共 997 字,大约阅读时间需要 3 分钟。
题目链接:
#includeint main() { int times; scanf("%d", ×); while (times--) { int M, temp; scanf("%d", &M); //A = 65; //正常打印 M = M % 26;//1= <=25时打印正常 for (int i = 1; i <= 2 * M + 1; i += 2) { if (i / 2 == 0) temp = 1; else temp = i - i / 2; for (int z = 0; z < 2 * M + 1 - temp; z++) { printf(" "); } for (int j = 0; j < temp; j++) { printf("%c", j + 65); } if (temp != 1) { for (int j = temp - 2; j >= 0; j--) { printf("%c", j + 65); } } printf("\n"); } //翻转打印 for (int i = 2 * M + 1 - 2; i >= 1; i -= 2) { if (i / 2 == 0) temp = 1; else temp = i - i / 2; for (int z = 0; z < 2 * M + 1 - temp; z++) { printf(" "); } for (int j = 0; j < temp; j++) { printf("%c", j + 65); } if (temp != 1) { for (int j = temp - 2; j >= 0; j--) { printf("%c", j + 65); } } printf("\n"); } } return 0;}
转载地址:https://blog.csdn.net/ZWHSOUL/article/details/79689697 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2024年04月23日 11时24分43秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
棱镜门事件
2019-04-29
拼多多远程删除用户照片事件
2019-04-29
power BI desktop
2019-04-29
中国信息化发展八大趋势(一)
2019-04-29
中国信息化发展八大趋势(二)
2019-04-29
中国信息化发展八大趋势(三)
2019-04-29
中国信息化发展八大趋势(四)
2019-04-29
电商大战二十年
2019-04-29
神奇的麦考林
2019-04-29
centos7使用rpm安装mysql遇到的error: Failed dependencies: mysql-community-common(x86-64) 5.7.9 is needed
2019-04-29
spark报错:warn util.utils::service ‘sparkUI‘ can not bind on part 4040.Attempting port 4041.4042等错误
2019-04-29
Error getting authority: Error initializing authority: Could not connect: No such file or directory
2019-04-29
编程程软件测试思维方式:如何科学制定测试计划
2019-04-29
BLE蓝牙4.0串口调试助手
2019-04-29
树莓派WIFI设置
2019-04-29
用vcgencmd获取树莓派硬件状态数据
2019-04-29
IIS 多域名多张证书配置
2019-04-29
树莓派LINUX 截屏
2019-04-29
树莓派Raspberry Pi的嵌入式QT平台
2019-04-29