当前位置:网站首页>1036 跟奥巴马一起编程 (15 分)
1036 跟奥巴马一起编程 (15 分)
2022-08-11 06:46:00 【呆比特】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//輸入
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
String c = scanner.next();
//先打印第一行
for (int i = 0; i < n; i++){
System.out.print(c);
}
System.out.println();
//再打印n-1行
for (int i = 0; i < Math.round(n * 0.5-2); i++){
System.out.print(c);
for (int k = 0; k < n-2; k++)
System.out.print(" ");
System.out.println(c);
}
//打印最后一行
for (int i = 0; i < n; i++){
System.out.print(c);
}
}
}
结果:
边栏推荐
猜你喜欢
随机推荐
Unity开发者必备的C#脚本技巧
LeetCode刷题系列 -- 46. 全排列
Waldom Electronics宣布成立顾问委员会
【推荐系统】:协同过滤和基于内容过滤概述
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
从 dpdk-20.11 移植 intel E810 百 G 网卡 pmd 驱动到 dpdk-16.04 中
unable to extend table xxx by 1024 in tablespace xxxx
年薪40W测试工程师成长之路,你在哪个阶段?
深度监督(中继监督)
如何选择专业、安全、高性能的远程控制软件
详述 MIMIC护理人员信息表(十五)
Douyin get douyin share password url API return value description
Discourse's Close Topic and Reopen Topic
【Pytorch】nn.Linear,nn.Conv
Pico neo3 Unity打包设置
Implement general-purpose, high-performance sorting and quicksort optimizations
Daily sql: request for friend application pass rate
计算YUV文件的PSNR与SSIM
数仓开发知识总结
网络电话软件或迎整顿 “免费”通话须迈安全关