hour_minute_second

You have to convert the given time (seconds) into the following format..hour:minute:second

IN

123

OUT

0:2:3
Login to submit solution


55 symbols python3 failed test 1 Code error

File "./code", line 2 print":".join(map(str,[a/3600,a/60%60,a%60])) ^ SyntaxError: invalid syntax

Thu Feb 12 21:35:10 2015 z423x5c6
a=input()
print":".join(map(str,[a/3600,a/60%60,a%60]))
61 symbols ruby failed test 1 Code error

./code:2:in `<main>': undefined method `/' for "123":String (NoMethodError)

Tue Sep 20 12:26:36 2016 JJonesJr
inp = gets.chomp;
puts "#{inp/60**3}:#{inp/60**2}:#{inp/60}";
65 symbols ruby failed test 1 Wrong answer
0:0:2
instead of
0:2:3
Tue Sep 20 12:28:26 2016 JJonesJr
inp= gets.chomp.to_i;
puts "#{inp/60**3}:#{inp/60**2}:#{inp/60}";
132 symbols ruby failed test 1 Wrong answer
123
instead of
0:2:3
Tue Sep 20 12:38:20 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{inp/60**3}";
inp= inp % 60**3;
str += ":#{inp/60**2}";
inp= inp % 60**2;
str += ":#{inp}";
puts inp;

124 symbols ruby failed test 1 Wrong answer
3
instead of
0:2:3
Tue Sep 20 12:40:50 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{inp/60**2}";
inp= inp % 60**2;
str += ":#{inp/60}";
inp= inp % 60;
str += ":#{inp}";
puts inp;
126 symbols ruby failed test 1 Wrong answer
3
instead of
0:2:3
Tue Sep 20 12:44:32 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{inp/60**2}";
inp= inp % (60**2);
str += ":#{inp/60}";
inp= inp % 60;
str += ":#{inp}";
puts inp;
133 symbols ruby failed test 1 Wrong answer
3
instead of
0:2:3
Tue Sep 20 12:45:35 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{(inp/60**2).to_s}";
inp= inp % (60**2);
str += ":#{inp/60}";
inp= inp % 60;
str += ":#{inp}";
puts inp;
142 symbols ruby failed test 1 Wrong answer

                      
instead of
0:2:3
Tue Sep 20 12:47:47 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{(inp/60**2).to_s}";
inp= (inp % (60**2)).to_s;
str += ":#{inp.to_i/60}";
inp= (inp % 60).to_s;
str += ":#{inp}";
146 symbols ruby failed test 1 Wrong answer

                      
instead of
0:2:3
Tue Sep 20 12:51:39 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{ (inp/60**2).to_s }";
inp= (inp % (60**2)).to_s;
str += ":#{ inp.to_i/60 }";
inp= (inp % 60).to_s;
str += ":#{inp}";
160 symbols ruby failed test 1 Wrong answer
0
123
instead of
0:2:3
Tue Sep 20 12:52:24 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{(inp/60**2).to_s}";
puts str
inp= (inp % (60**2)).to_s;
puts inp
str += ":#{inp.to_i/60}";
inp= (inp % 60).to_s;
str += ":#{inp}";
180 symbols ruby failed test 1 Wrong answer
0
123
0:2
123
instead of
0:2:3
Tue Sep 20 12:53:07 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{(inp/60**2).to_s}";
puts str
inp= (inp % (60**2)).to_s;
puts inp
str += ":#{inp.to_i/60}";
puts str;
inp= (inp % 60).to_s;
puts inp;
str += ":#{inp}";
185 symbols ruby failed test 1 Wrong answer
0
123
0:2
3
instead of
0:2:3
Tue Sep 20 12:57:06 2016 JJonesJr
inp= gets.chomp.to_i;
str= "#{(inp/60**2).to_s}";
puts str
inp= (inp % (60**2)).to_s;
puts inp
str += ":#{inp.to_i/60}";
puts str;
inp= (inp.to_i % 60).to_s;
puts inp;
str += ":#{inp}";
5 symbols perl failed test 1 Code error

syntax error at ./code line 1, near "0:" Execution of ./code aborted due to compilation errors.

Sun Jun 25 16:19:48 2017 Sifa_Grent
0:2:3

View all solutions