当前位置:网站首页>Acwing727. Diamond pattern
Acwing727. Diamond pattern
2022-07-26 11:50:00 【mfg_】

Manhattan distance

// Manhattan distance
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int cx=n/2;
int cy=n/2;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(Math.abs(i-cx)+Math.abs(j-cy)<=n/2){
System.out.print("*");
}else{
System.out.print(" ");
}
}
System.out.println();// Line break
}
}
}
边栏推荐
- On vio's IMU pre integration (the idea when I first started)
- Practice of microservice in solving Library Download business problems
- GA-RPN:引导锚点的建议区域网络
- js使用WebUploader做大文件的分块和断点续传
- 沟通中经常用到的几个库存术语
- [communication principle] Chapter 2 -- deterministic signal
- Big view +500 cases, software teams should improve R & D efficiency in this way!
- 『MongoDB』MongoDB高可用部署架构——复制集篇(Replica Set)
- Integrity constraints of SQL Server database
- Build neural network from simple to deep
猜你喜欢

Outsourcing for four years, abandoned

如何使用数据管道实现测试现代化

元宇宙日报|元宇宙社交 App“派对岛”产品下架;广州南沙元宇宙产业集聚区揭牌;数字经济发展部际联席会议制度推出

ESP8266-Arduino编程实例-开发环境搭建(基于PlatformIO)

MICCAI2022论文 | 进化多目标架构搜索框架:在COVID-19三维CT分类中的应用

Data center construction (II): brief introduction to data center

征婚故事

Build neural network from simple to deep

Esp8266 Arduino programming example - development environment construction (based on platformio)

3.2 创建菜单与游戏页面(下)
随机推荐
Esp8266 Arduino programming example - know esp8266
An online duplicate of a hidden bug
PostgreSQL在Linux和Windows安装和入门基础教程
X 2 earn must rely on Ponzi startup? Where is the way out for gamefi? (top)
外包干了四年,废了...
28. Implementation of file directory parsing code
GA-RPN:引导锚点的建议区域网络
Redis database, which can be understood by zero foundation Xiaobai, is easy to learn and use!
swagger2.9.2教程 与swagger3.0.0教程
[error reported]exception: found duplicate column (s) in the data schema: `value`;
28.文件目录解析代码实现
Understanding of Abstract Programming
Ten year structure five year life-06 impulse to leave
Mlx90640 infrared thermal imager temperature sensor module development notes (6)
最新心形拼图小程序源码+带流量主
Blue screen problem in win10 1903 notebook hot spot
【云驻共创】为了写好代码,你坚持了哪些好习惯?
打造绿色数据中心,Colt DCS 是认真的!
虚拟偶像代言产品出问题谁负责? 且听律师分析
想让照片中的云飘起来?视频编辑服务一键动效3步就能实现