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

边栏推荐
- pnpm的安装与使用
- Opencv macro definition
- Applet waterfall flow, upload pictures, simple use of maps
- MySQL transaction (this is enough...)
- Solution: direct local.Aar file dependencies are not supported when building an aar
- Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接
- JS four formulas for judging data types
- Locally connect to redis on Windows Server
- 研发效能的道法术器
- Everything you have learned will come in handy at some point in your life (turn)
猜你喜欢

Simple use and understanding of laravel message queue

Api 接口优化有哪些技巧?

IDEA报错Error running ‘Application‘ Command line is too long解决方案

How NAT configures address translation

vscode下链接远程服务器安装插件失败、速度慢等解决方法

Basic knowledge of PHP language (super detailed)

Where is sandbox's confidence in rejecting meta's acquisition of meta universe leader sand?

110 MySQL interview questions and answers (continuously updated)

Dynamic programming problem (VII)

Solution: direct local.Aar file dependencies are not supported when building an aar
随机推荐
MySQL的存储过程
[microservice] Nacos cluster building and loading file configuration
@Transactional 注解使用详解
Cause analysis of 12 MySQL slow queries
研发效能的道法术器
Network traffic monitoring tool iftop
Leetcode62. Different paths
PHP语言基础知识(超详细)
Laravel permission control
Detailed explanation of the usage of exists in MySQL
Three years after graduation, write to you and me who may be confused [turn]
【微服务~Nacos】Nacos服务提供者和服务消费者
Principle of meter skipping
Dynamic programming problem (3)
Detailed principle explanation and verification results of digital clock based on FPGA
Dual for loop optimization
Why is it so difficult for the SEC to refuse the application for transferring gray-scale GBTC to spot ETF? What is the attraction of ETF transfer?
Software designer afternoon question
Applet verification code login
Leetcode61. rotating linked list