您的位置:首页 > 其它

1002 -- 手机靓号

2015-08-29 03:12 411 查看
手机靓号
Time Limit:1000MS Memory Limit:65536K

Total Submit:470 Accepted:208
Description
Description:

小风凉刚买了手机,去营业厅开户,营业员让其挑选自己喜欢的号码,但那么多的号码着实让他眼花,他对号码的要求是在号码中6和8的个数要不少于5个,并且没有数字4,于是就请你给他编了一个程序。

Input
Input:

输入不多于50组的数(手机号码),每个数以13或15开头,长为11位。

Output
Output:

输出数中,含有6和8不少于5个,并且没有4的数,并统计号码的个数。

Sample Input
13656689866
13805880343
15967126781
13808866888

Sample Output
13656689866
13808866888
2

Source
zjahstu

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AK1002 {
class Program {
static void Main(string[] args) {
string sb;
int jtahstu = 0;
while ((sb = Console.ReadLine()) != null) {
int count = 0;
for (int k = 0; k < 11; k++) {
if (sb[k] == '6' || sb[k] == '8')
count++;
if (sb[k] == '4') { count = 0; break; }
}
if (count > 4) {
Console.WriteLine(sb);
jtahstu++;
}
}
Console.WriteLine(jtahstu);
//Console.ReadLine();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: