题解 | #小乐乐定闹钟#
小乐乐定闹钟
https://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
using System; public class Program { public static void Main() { string[] s = Console.ReadLine().Split(" "); string[] str = s[0].Split(":"); int[] ints = 字符数组转整型数组(str); int met = int.Parse(s[1]); ints[0] += met / 60; ints[1] += met % 60; if (ints[1] >= 60) { ints[0]++; ints[1] -= 60; } Console.WriteLine("{0:D2}:{1:D2}",ints[0]%24 , ints[1]); } static int[] 字符数组转整型数组(string[] s) { int[] arr = new int[s.Length]; for (int i = 0; i < s.Length; i++) { arr[i] = int.Parse(s[i]); } return arr; } }