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

边栏推荐
猜你喜欢

Do like and in indexes in MySQL go

Attack and defense world web master advanced area php2

Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R

#{}和${}的区别

AutoCAD -- import excel tables into CAD and merge CAD

Use hutool tool class to operate excel with more empty Sheet1

Recursion / backtracking (Part 2)

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

Exchange 2013 SSL certificate installation document

ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
随机推荐
Install MySQL using Yum for Linux
Network traffic monitoring tool iftop
[applet project development -- JD mall] uni app commodity classification page (first)
Camera Hal OEM模块 ---- cmr_preview.c
动态规划问题(二)
R语言怎么学
With this, your messages can't be monitored
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
动态规划问题(六)
#{}和${}的区别
Dynamic programming problem (6)
Real time data warehouse: Didi's real-time data warehouse landing practice
Idea connection database
Data warehouse: Doris' application practice in meituan
vscode下链接远程服务器安装插件失败、速度慢等解决方法
Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
flyway的快速入门教程
Table custom style row class name in elemenui
Detailed principle explanation and verification results of digital clock based on FPGA
“Method Not Allowed“,405问题分析及解决