题解 | #四季#
四季
https://www.nowcoder.com/practice/eaf21203b61b4a689987fdc165d00dfc
public class Program { public static void Main() { string line = System.Console.ReadLine(); string Num = line.Substring(4); string Nums = Num.Substring(0); //用Converet用转成Ascii码值,-48变成原来的数 int shi = (System.Convert.ToInt32(Nums[0])) - 48; int ge = (System.Convert.ToInt32(Nums[1])) - 48; int OutNum = 10; //10月份到12月份 if (shi >= 1) { OutNum += ge; } else { OutNum -= 10; OutNum += ge; } if (OutNum >= 3 && OutNum <= 5) System.Console.WriteLine("spring"); else if (OutNum >= 6 && OutNum <= 8) System.Console.WriteLine("summer"); else if (OutNum >= 9 && OutNum <= 11) System.Console.WriteLine("autumn"); else if (OutNum >= 12 || OutNum <= 2) System.Console.WriteLine("winter"); } }