1089 -- 寻找幸运数

来源:互联网 发布:淘宝天猫评价提取工具 编辑:程序博客网 时间:2024/06/05 02:52

寻找幸运数

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 170169 170 200-1 -1 -1

Sample Output

CRASH 160NO 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");                    }                }            }        }    }


0 0
原创粉丝点击