Basic exercises - time conversion


title: the basis of practice time conversion
categories:

  • ACM
  • Hex
    tags:
  • Water problems
    date: 2020-03-14 17:10:50

Decimal turn reciprocal six decimal third place

topic

Questions the basis of practice time conversion

By submitting this question

Resource constraints

Time limit: 1.0s Memory Limit: 512.0MB

Problem Description

Given a time in units of seconds t, requirements for ":: to represent the time" format. Indicating time minutes, and indicates seconds, which are integers with no leading "0." For example, if t = 0, the output should be "0: 0: 0"; if t = 3661, and outputs "1: 1: 1."

Input Format

Only one line input, an integer t (0 <= t <= 86399).

Output Format

Output only one line, based on ":: Time" format indicated, without the quotes.

Sample input

0

Sample Output

0:0:0

Sample input

5436

Sample Output

1:30:36

algorithm

#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main(){	
//freopen("input.txt", "r", stdin);
	int t;
	cin>>t;
	int h=t/(60*60);
	t-=h*(60*60);
	int m=t/60;
	t-=m*60;
	cout<<h<<":"<<m<<":"<<t;
}
Published 43 original articles · won praise 1 · views 917

Guess you like

Origin blog.csdn.net/qq_43985303/article/details/104865575