当前位置:网站首页>3564. Date category
3564. Date category
2022-07-28 15:13:00 【Pursue people far away】
Write a date class , Required press xxxx-xx-xx Output date in the format of , Realize the operation of adding one day .
Input format
The first line contains integers T, Expressing common ownership T Group test data .
Each group of data occupies one row , contain 3 Integers separated by spaces , It means the day, month and year respectively .
Output format
Output one row per group of data , A result , Press xxxx-xx-xx Format output , Representing the input date The next day Date .
Data range
The input date is guaranteed to be legal and there will be no leap year .
Year range [1000,3000][1000,3000]
sample input :
2
1999 10 20
2001 1 31
sample output :
1999-10-21
2001-02-01
Code :
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int months[] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
int n;
cin >> n;
while (n--)
{
int yy, mm, dd;
cin >> yy >> mm >> dd;
dd++;
if (dd > months[mm])
{
dd = 1;
mm++;
if (mm > 12)
{
mm = 1;
yy++;
}
}
printf("%04d-%02d-%02d\n", yy, mm, dd);
}
return 0;
}
边栏推荐
- Compilation language and interpretation language
- 22、 TF coordinate transformation (II): static coordinate transformation
- 苹果iPhone手机APP应用图标隐藏怎么找回恢复显示在iPhone苹果手机桌面显示被隐藏的应用APP图标到iPhone苹果手机桌面?
- CCSP 云安全设计原则都有哪些
- How to gracefully encapsulate anonymous inner classes (DSL, high-order functions) in kotlin
- Three pop-up boxes commonly used in JS
- 滑块还原和验证(法律数据库)
- Repvgg paper explanation and model reproduction using pytoch
- Wonderful frog -- how simple can it be to abandon the float and use the navigation bar set by the elastic box
- Compose learning notes 1-compose, state, flow, remember
猜你喜欢

idea调试burpsuit插件

使用cpolar发布树莓派网页(apache2网页的发布)

2021 year end summary of gains and losses

Find papers and their open source code

Untitled may

即刻体验 | 借助 CTS-D 进一步提升应用设备兼容性

PS modify the length and width pixels and file size of photos

Knowledge map Foundation (I) - what is knowledge map

Compose learning notes 2 - launchedeffect, status and status management

6、 C language circular statement
随机推荐
4519. 正方形数组的数目
QT hex, decimal, qbytearray, qstring data conversion
Keras reported an error using tensorboard: cannot stop profiling
Some considerations for installing Oracle11g
云上安全主要面临的威胁有哪些
JS学习笔记18-23
安全与隐私计算在国内发展现状
苹果iPhone手机APP应用图标隐藏怎么找回恢复显示在iPhone苹果手机桌面显示被隐藏的应用APP图标到iPhone苹果手机桌面?
Why do enterprises need user autonomous digital identity
模板注入总结
即刻体验 | 借助 CTS-D 进一步提升应用设备兼容性
10、 C enum enumeration
SSL socket cross platform solution libevent OpenSSL
QT qlineedit, qtextedit, qplaintextedit differences
MLX90640 红外热成像仪传感器模块开发笔记(八)
JS常用的3种弹出框
The first self introduction quotation
Install pytorch geometric on colab, and libcudart.so.10.2 appears when importing the package
Word creates a title list with automatic numbering
安装mosek,license安装位置查找