1089 -- 寻找幸运数

寻找幸运数

Time Limit:1000MS  Memory Limit:65536K
Total Submit:306 Accepted:138

Description

给定三个整数(0≤A1,A2,A3≤10000),请找出第一个不大于168的数。如果存在该数,输出"CRASH"并空一格输出该数,否则输出"NO CRASH"。遇到A1=A2=A3=-1则运行结束。

Input

Output

Sample Input

180 160 170
169 170 200
-1 -1 -1

Sample Output

CRASH 160
NO CRASH

Source

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    namespace AK1089 {
        class Program {
            static void Main(string[] args) {
                string s;
                while ((s = Console.ReadLine()) != null) {
                    string[] sb = s.Split();
                    int a = int.Parse(sb[0]), b = int.Parse(sb[1]), c = int.Parse(sb[2]);
                    if (a + b + c == -3) break;
                    else {
                        bool flag = false;
                        if (a <= 168) {
                            flag = true;
                            Console.WriteLine("CRASH {0}", a);
                        }
                        if (!flag && b <= 168) {
                            flag = true;
                            Console.WriteLine("CRASH {0}", b);
                        }
                        if (!flag && c <= 168) {
                            flag = true;
                            Console.WriteLine("CRASH {0}", c);
                        }
                        if (!flag)
                            Console.WriteLine("NO CRASH");
                    }
                }
            }
        }
    }


你可能感兴趣的:(akoj)