当前位置:网站首页>PTA (daily question) 7-73 turning triangle
PTA (daily question) 7-73 turning triangle
2022-07-29 00:23:00 【Little Deng programmer who can write bugs】
Enter an integer n, It is required to use numbers 1 To n Arrange a steering triangle . for example ,n=5 when , The steering triangle is shown in the output example .
Input format :
First enter a positive integer T, Number of groups representing test data , And then there was T Group test data . Each set of test data input 1 It's an integer n(1≤n≤9).
Output format :
For each group of test data , Output a with 2n-1 Yes , By digital 1…n…1 A steering triangle ( See the output example ).
sample input :
1
5
sample output :
1
22
333
4444
55555
4444
333
22
1
Code :
t = int(input())
for i in range(t):
n = int(input())
for i in range(1, n+1):
for j in range(i):
print(i,end='')
print()
for i in range(1,n):
for j in range(n-i):
print(n-i, end='')
print()

边栏推荐
- Centos7 install mysql8
- Applet editor rich text editing and rich text parsing
- Introduction and solution of common security vulnerabilities in Web System SQL injection
- Android studio connects to MySQL and completes simple login and registration functions
- Sword finger offer 55 - I. depth of binary tree
- DCAT in laravel_ Admin preliminary use record
- IDEA 连接 数据库
- Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
- vulnhub:SolidState
- Data warehouse: Doris' application practice in meituan
猜你喜欢

Control fillet stroke materialshapedrawable

Okaleido ecological core equity Oka, all in fusion mining mode

Web系统常见安全漏洞介绍及解决方案-sql注入

Html+css+php+mysql realize registration + login + change password (with complete code)

Principle of meter skipping

Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track

MySQL 分库分表及其平滑扩容方案

Basic knowledge of PHP language (super detailed)

Field injection is not recommended solution

Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
随机推荐
DCAT in laravel_ Admin preliminary use record
Kali installs burpsuite professional
Control fillet stroke materialshapedrawable
110道 MySQL面试题及答案 (持续更新)
Simple use and understanding of laravel message queue
vulnhub:SolidState
Have passed hcip and joined the company of your choice, and share the learning experience and experience of Huawei certification
Do like and in indexes in MySQL go
IDEA报错Error running ‘Application‘ Command line is too long解决方案
Everything you have learned will come in handy at some point in your life (turn)
Attack and defense world web master advanced area web_ php_ unserialize
动态规划问题(七)
Software designer afternoon question
2022网络安全学习路线 非常详细 推荐学习
ES6 operation tutorial
Dynamic programming (V)
Laptop external display
pnpm的安装与使用
2022 network security learning route is very detailed, recommended Learning
@PostConstruct注解详解