当前位置:网站首页>Time conversion ()
Time conversion ()
2022-07-03 14:33:00 【Study hard 867】
This question requires the preparation of procedures , With hh:mm:ss
Output in the format of... After a given time n
Time value after seconds ( exceed 23:59:59 From 0 The clock starts at ).
Input format :
Enter in the first line with hh:mm:ss
The format of gives the start time , The second line gives the number of whole seconds n
(<60).
Output format :
The output is given on one line hh:mm:ss
Result time in format .
sample input :
11:59:40
30
sample output :
12:00:10
Code :
#include <stdio.h>
int main(){
int h,m,s;
scanf("%d:%d:%d",&h,&m,&s);
int n;
scanf("%d",&n);
n=n+s;
if(n>=60){
n=n%60;
m++;
if(m>=60){
m=m%60;
h++;
}
}
if(h==24)h=h-24;
printf("%02d:%02d:%02d",h,m,n);
}
边栏推荐
- 7-19 check denomination (solve binary linear equation)
- J-luggage lock of ICPC Shenyang station in 2021 regional games (simple code)
- 超简单手机地图开发
- adc128s022 ADC verilog设计实现
- FPGA blocking assignment and non blocking assignment
- How Facebook moves instagram from AWS to its own server
- 中国锂电池电解液行业市场专项调研报告(2022版)
- 编程语言:类型系统的本质
- protobuf与grpc
- Sendmail can't send mail and it's too slow to send. Solve it
猜你喜欢
Exercise 10-1 calculate the sum of 1 to n using recursive functions
tonybot 人形机器人 红外遥控玩法 0630
Exercise 6-6 use a function to output an integer in reverse order
retrofit
中感微冲刺科创板:年营收2.4亿净亏1782万 拟募资6亿
Why is this error reported when modifying records in the database
Detailed explanation of four modes of distributed transaction (Seata)
556. The next larger element III
Leetcode (4) -- find the median of two positively ordered arrays
Leetcode(4)——尋找兩個正序數組的中比特數
随机推荐
使用并行可微模拟加速策略学习
7-19 check denomination (solve binary linear equation)
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
China PETG market forecast and Strategic Research Report (2022 Edition)
Strategy, tactics (and OKR)
String sort
7-2 and then what time (15 minutes)
修改数据库中的记录为什么报这个错
Use of constraintlayout
Puzzle (016.4) domino effect
7-28 monkeys choose King (Joseph problem)
牛客网:过河卒
String substitution
分布式事务(Seata) 四大模式详解
Accelerating strategy learning using parallel differentiable simulation
7-10 calculate salary
Find specified characters
洛谷P5536 【XR-3】核心城市 题解
Showmebug entered Tencent conference, opening the era of professional technical interview
Selective sorting