#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#pragma GCC optimize("Ofast")
#define ll long long
using namespace std;
ll digits(ll a){
if(a == 0)
return 1;
ll cnt = 0;
while(a > 0){
a /= 10;
cnt++;
}
return cnt;
int main() {
ll n;
cin >> n;
ll h = n/3600;
h %= 24;
n %= 3600;
ll m = n/60;
ll s = n % 60;
cout << h << ':';
if(digits(m) == 1)
cout << 0;
cout << m << ':';
if(digits(s) == 1)
cout << s;
на информатиксе 100 :)
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
string dig(int n)
{
string st="";
if (n>9) { st=st+char(n%10+48); st=char(n/10+48)+st; }
else st=st+'0'+char(n+48);
return(st);
}
int main(int argc, char** argv) {
int n,k,m,sc;
string s="";
cout<<"n = "; cin>>n; cout<<endl;
k=n/3600;
m=(n-k*3600)/60;
sc=n-k*3600-m*60;
if (k>24) k=k%24;
if (k<10) s=s+char(k+48)+':';
else s=s+dig(k)+':';
s=s+dig(m)+':';
s=s+dig(sc);
cout<<"time: "<<s<<endl;
system("pause");
return(0);
}
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#pragma GCC optimize("Ofast")
#define ll long long
using namespace std;
ll digits(ll a){
if(a == 0)
return 1;
ll cnt = 0;
while(a > 0){
a /= 10;
cnt++;
}
return cnt;
}
int main() {
ll n;
cin >> n;
ll h = n/3600;
h %= 24;
n %= 3600;
ll m = n/60;
ll s = n % 60;
cout << h << ':';
if(digits(m) == 1)
cout << 0;
cout << m << ':';
if(digits(s) == 1)
cout << 0;
cout << s;
}
на информатиксе 100 :)