Created
May 23, 2012 15:22
-
-
Save yuuki/2775863 to your computer and use it in GitHub Desktop.
SRM Div2-144 200score
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdlib> | |
#include <cmath> | |
#include <climits> | |
#include <cfloat> | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
class Time { | |
public: | |
string whatTime(int seconds) { | |
int h = seconds / 3600; | |
int m = seconds % 3600 / 60; | |
int s = seconds % 60; | |
char ss[9]; | |
snprintf(ss, 9, "%d:%d:%d", h, m, s); | |
return ss; | |
} | |
}; | |
int main() { | |
Time time; | |
cout << time.whatTime(0) << endl; | |
cout << time.whatTime(3661) << endl; | |
cout << time.whatTime(5436) << endl; | |
cout << time.whatTime(86399) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment