当前位置:网站首页>PTA (daily question) 7-74 yesterday
PTA (daily question) 7-74 yesterday
2022-07-29 00:23:00 【Little Deng programmer who can write bugs】
Xiao Ming likes the calculation of dates . What he wants to do this time is to subtract the date 1 Day operation , That is, subtract... From the input date 1 Result date in days .
for example : The date is 2019-10-01, subtract 1 God , Then the result date is 2019-09-30.
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 inputs 1 Date , Date form is “yyyy-mm-dd”. Ensure that the date entered is legal , And the entered date and calculation results are in [1000-01-01,9999-12-31] Within the scope of .
Output format :
For each group of tests , On a line with “yyyy-mm-dd” Output results in the form of .
sample input :
1
2019-10-01
sample output :
2019-09-30
Code :
import datetime
t = int(input())
for i in range(t):
my_time = input()
now_time = datetime.datetime.strptime(my_time, '%Y-%m-%d')
new_time = now_time + datetime.timedelta(days=-1)
print(str(new_time).split()[0])

边栏推荐
- pnpm的安装与使用
- vulnhub:Sar
- Advanced area of attack and defense world web masters warmup
- MQ 消息丢失、重复、积压问题,如何解决?
- Dynamic programming problem (3)
- "Method not allowed", 405 problem analysis and solution
- Applet waterfall flow, upload pictures, simple use of maps
- Attack and defense world web master advanced area php2
- Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接
- 动态规划问题(四)
猜你喜欢

Introduction and solution of common security vulnerabilities in web system CSRF attack

Attack and defense world web master advanced area php2

动态规划问题(五)

110道 MySQL面试题及答案 (持续更新)

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?

Real time data warehouse: meituan's implementation of real-time data warehouse construction based on Flink

Concurrency in go

Detailed explanation of 9 common reasons for MySQL index failure

Recursion / backtracking (Part 2)

html+css+php+mysql实现注册+登录+修改密码(附完整代码)
随机推荐
@Detailed explanation of the use of transactional annotation
Detailed explanation of the usage of exists in MySQL
IDEA 连接 数据库
Simple use and understanding of laravel message queue
Visual full link log tracking
Add build dependency error
Newscenter, advanced area of attack and defense world web masters
Es6操作教程
Cause analysis of 12 MySQL slow queries
Google browser, no installation required
Web系统常见安全漏洞介绍及解决方案-CSRF攻击
Attack and defense world web master advanced area web_ php_ include
分布式限流 redission RRateLimiter 的使用及原理
vulnhub:Sar
Where is sandbox's confidence in rejecting meta's acquisition of meta universe leader sand?
Real time data warehouse: meituan's implementation of real-time data warehouse construction based on Flink
Redis learning notes
Field injection is not recommended solution
MySql中的like和in走不走索引
1331. 数组序号转换 : 简单模拟题