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

边栏推荐
猜你喜欢

Network traffic monitoring tool iftop

“Method Not Allowed“,405问题分析及解决

Application of Devops in Internet of things solutions

Geth installation

Web系统常见安全漏洞介绍及解决方案-CSRF攻击

Centos7 install mysql8

html+css+php+mysql实现注册+登录+修改密码(附完整代码)
![[microservice] Nacos cluster building and loading file configuration](/img/50/7af220c57a06eb186729c9882d9dab.png)
[microservice] Nacos cluster building and loading file configuration

Html+css+php+mysql realize registration + login + change password (with complete code)

Laravel8 middleware realizes simple permission control
随机推荐
2022 network security learning route is very detailed, recommended Learning
Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接
Develop effective Tao spell
Sword finger offer 55 - I. depth of binary tree
Advanced area of attack and defense world web masters supersqli
MySQL installation and configuration tutorial (super detailed, nanny level)
MySQL的存储过程
Laravel permission control
PTA (daily question) 7-70 diamond
1331. 数组序号转换 : 简单模拟题
[CNN] Why is the convolution kernel size of CNN usually odd
Advanced area of attack and defense world web masters warmup
Cause analysis of 12 MySQL slow queries
Dynamic programming problem (VIII)
MySQL 分库分表及其平滑扩容方案
Web系统常见安全漏洞介绍及解决方案-sql注入
What does the expression > > 0 in JS mean
mysql中exists的用法详解
Principle of meter skipping
vulnhub:Sar