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

边栏推荐
- MySQL transaction (this is enough...)
- R语言怎么学
- 动态规划问题(八)
- Advanced area of attack and defense world web masters -baby Web
- Concurrency in go
- [small bug diary] Navicat failed to connect to MySQL | MySQL service disappeared | mysqld installation failed (this application cannot run on your computer)
- Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
- CV target detection model sketch (2)
- Event extraction and documentation (2008-2017)
- Dynamic programming problem (4)
猜你喜欢

Application of Devops in Internet of things solutions

ACM SIGIR 2022 | interpretation of selected papers of meituan technical team

IDEA2021.2安装与配置(持续更新)

Idea error running 'application' command line is too long solution

vulnhub:Sar

Solution: direct local.Aar file dependencies are not supported when building an aar

Exchange 2013 SSL certificate installation document

Develop effective Tao spell

Kali installs burpsuite professional

ES6 operation tutorial
随机推荐
Oracle super full SQL, details crazy
Alibaba Code代码索引技术实践:为Code Review提供本地IDE的阅读体验
AutoCAD -- import excel tables into CAD and merge CAD
Laravel permission control
[small bug diary] Navicat failed to connect to MySQL | MySQL service disappeared | mysqld installation failed (this application cannot run on your computer)
Centos7 install mysql8
Newscenter, advanced area of attack and defense world web masters
Idea2021.2 installation and configuration (continuous update)
Attack and defense world web master advanced area php2
MySQL installation and configuration tutorial (super detailed, nanny level)
MySQL transaction (this is enough...)
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
Eye of depth (18) -- partial derivative
乱打日志的男孩运气怎么样我不知道,加班肯定很多!
Cmake basic learning
Simple use and understanding of laravel message queue
vulnhub:BTRSys2
Introduction and solution of common security vulnerabilities in web system CSRF attack
Software designer - intermediate, exam summary
Application of Devops in Internet of things solutions