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

边栏推荐
- Applet waterfall flow, upload pictures, simple use of maps
- Okaleido ecological core equity Oka, all in fusion mining mode
- Attack and defense world web master advanced area PHP_ rce
- Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接
- Erc20 Standard Code
- Dynamic programming problem (2)
- 1331. 数组序号转换 : 简单模拟题
- Develop effective Tao spell
- 面试被问到了String相关的几道题,你能答上来吗?
- Using recursion and chain header interpolation to realize the group turnover of linked lists -- leetcode25 K group turnover linked lists
猜你喜欢

Locally connect to redis on Windows Server

Attack and defense world web master advanced area php2

Concurrency in go

Cause analysis of 12 MySQL slow queries

Plato farm is expected to further expand its ecosystem through elephant swap

Google browser, no installation required

Centos7 install mysql8

Laravel permission control

Okaleido ecological core equity Oka, all in fusion mining mode

Install mysql5.7 under Linux, super detailed complete tutorial, and cloud MySQL connection
随机推荐
Software designer - intermediate, exam summary
@Detailed explanation of postconstruct annotation
Camera Hal OEM模块 ---- cmr_preview.c
Control fillet stroke materialshapedrawable
Compilation principle research study topic 2 -- recursive descent syntax analysis design principle and Implementation
Dual for loop optimization
聊聊异步编程的 7 种实现方式
Newscenter, advanced area of attack and defense world web masters
Api 接口优化有哪些技巧?
#{}和${}的区别
Exchange 2013 SSL certificate installation document
Oracle超全SQL,细节狂魔
Redis learning notes
Concurrency in go
110道 MySQL面试题及答案 (持续更新)
Install mysql5.7 under Linux, super detailed complete tutorial, and cloud MySQL connection
html+css+php+mysql实现注册+登录+修改密码(附完整代码)
Attack and defense world web master advanced area web_ php_ unserialize
PHP语言基础知识(超详细)
Attack and defense world web master advanced area web_ php_ include