Skip to content

Instantly share code, notes, and snippets.

@danicat
Created January 5, 2014 18:53
Show Gist options
  • Save danicat/8272287 to your computer and use it in GitHub Desktop.
Save danicat/8272287 to your computer and use it in GitHub Desktop.
TopCoder SRM 144 Division 2 200 points problem.
#include <vector>
#include <string>
#include <sstream>
using std::vector;
using std::string;
using std::stringstream;
class Time {
public:
string whatTime(int seconds) {
int hh = seconds / 3600;
int mm = (seconds % 3600) / 60;
int ss = (seconds % 3600) % 60;
stringstream st;
st << hh << ":" << mm << ":" << ss;
return st.str();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment