当前位置:网站首页>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()

边栏推荐
- IDEA2021.2安装与配置(持续更新)
- Laravel permission control
- 面试被问到了String相关的几道题,你能答上来吗?
- MySQL事务(transaction) (有这篇就足够了..)
- Event extraction and documentation (2018)
- Field injection is not recommended solution
- Html+css+php+mysql realize registration + login + change password (with complete code)
- Dynamic programming problem (6)
- Idea2021.2 installation and configuration (continuous update)
- Api 接口优化有哪些技巧?
猜你喜欢

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

Event extraction and documentation (2018)

Dynamic programming problem (VIII)

Develop effective Tao spell

The difference between {} and ${}

Dynamic programming problem (3)
![[CNN] Why is the convolution kernel size of CNN usually odd](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[CNN] Why is the convolution kernel size of CNN usually odd

Field injection is not recommended solution

Advanced area of attack and defense world web masters ics-06

Laravel8 middleware realizes simple permission control
随机推荐
Application of Devops in Internet of things solutions
Applet editor rich text editing and rich text parsing
Concurrency in go
Cause analysis of 12 MySQL slow queries
What does WGet mean
@Detailed explanation of postconstruct annotation
Eye of depth (18) -- partial derivative
聊聊异步编程的 7 种实现方式
NPM replace the latest Taobao image
Idea connection database
动态规划问题(七)
Laptop external display
Installation and use of pnpm
Okaleido ecological core equity Oka, all in fusion mining mode
Field injection is not recommended solution
Cmake basic learning
PHP语言基础知识(超详细)
DCAT in laravel_ Admin preliminary use record
Principle of meter skipping
[applet project development -- JD mall] uni app commodity classification page (first)