| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12004 | Digital Clock |
|
| 12005 | AC code |
|
Description
Given an integer t representing a time in seconds, output the time in hh:mm:ss format (24-hour).
For example, if t = 12345, then output "03:25:45" (without the quotes); if t = 0, then output "00:00:00" (without the quotes).
Hint:
Please follow the format %02d:%02d:%02d when you use printf
A format specifier follows this prototype: %[flags][width][.precision][length]specifier
| width | |
| number | Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. |
| flag | description |
| 0 | Printing with the 0 (zero) flag fills in leading zeros. |
Example:
code: printf("%09d", 762);
output: 000000762
For more details, you can refer to the http://www.cplusplus.com/reference/cstdio/printf/
int main() {
int t;
scanf("%d", &t);
printf("%02d:%02d:%02d\n", t/3600, (t%3600)/60, t%60);
return 0;
}
Input
Input contains only a integer t, representing the time in seconds.
It is guaranteed that 0 <= t < 86400.
Output
Print out the 24-hour format of the time (format described above).
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Ben wants to complete his first homework in Introduction to Programming, but he wasn't listening to teacher during the class. So he came to you for help.
The homework problem is very simple: Print a number x. However, Ben forgot what value x is.
Since you think Ben is really annoying, as a clever CS student, you decide to write a program that can print the correct AC code no matter what the value x is, and give him the program.
For example, if x = 10, then the correct AC code will be "printf("10\n");"; if x = 5, then the correct AC code will be "printf("5\n");" (without the quotes).
Hint:
'\' is an escape character. You can use it to print '"'.
Example:
code: printf("welcome to \"NTHU CS\"");
output: welcome to "NTHU CS"
int main() {
int x;
scanf("%d", &x);
printf("printf(\"%d\\n\");\n", x);
return 0;
}
Input
Input contains an integer x, the number in Ben's homework.
It is guaranteed that 1 <= x <= 100.
Output
According to x, print the correct AC code in one line.