题解 | #水仙花数#
水仙花数
https://www.nowcoder.com/practice/dc943274e8254a9eb074298fb2084703
public class Program { public static void Main() { string result = ""; string inPut = ""; while ((inPut = System.Console.ReadLine()) != null) { string[] inPuts = inPut.Split(" "); int start = int.Parse(inPuts[0]); int end = int.Parse(inPuts[1]); bool isNum = false; for (int i = start; i <= end; i++) { int ge = i % 10; int shi = i / 10 % 10; int bai = i / 100; if (ge * ge * ge + shi * shi * shi + bai * bai * bai == i) { result += i.ToString() + " "; isNum = true; } } if (!isNum) result += "no"; result += "\n"; } System.Console.WriteLine(result); } }