Problem Description
Baby Ming collected lots of cell phone numbers, and he wants to sell them for money.

He thinks normal number can be sold for b yuan, while number with following features can be sold for a yuan.

.The last five numbers are the same. (such as --)

.The last five numbers are successive increasing or decreasing, and the diffidence between two adjacent digits is . (such as --)

.The last eight numbers are a date number, the date of which is between Jar 1st,  and Dec 31th, . (such as --,means August ninth,)

Baby Ming wants to know how much he can earn if he sells all the numbers.
 
Input
In the first line contains a single positive integer T, indicating number of test case.

In the second line there is a positive integer n, which means how many numbers Baby Ming has.(no two same phone number)

In the third line there are  positive integers a,b, which means two kinds of phone number can sell a yuan and b yuan.

In the next n lines there are n cell phone numbers.(|phone number|==, the first number can’t be )

≤T≤,b<,<a,n≤,
 
Output
How much Baby Nero can earn.
Sample Input

Sample Output

Source
 

判断日期的时候比较麻烦,也懒得去优化了,还有会爆int,这个值得注意

 #pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<stdlib.h>
#include <stack>
using namespace std;
#define PI acos(-1.0)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)
#define ll long long
#define eps 1e-10
#define MOD 1000000007
#define N 100006
#define inf 1e12
ll n,a,b;
char s[];
bool judge(char *s){
ll a=s[]-'';
ll b=s[]-'';
ll c=s[]-'';
ll d=s[]-'';
ll e=s[]-'';
if( (a==b+) && (b==c+) && (c==d+) && (d==e+) ) return true;
if( (a==b-) && (b==c-) && (c==d-) && (d==e-) ) return true;
return false;
}
bool riqi(ll month,ll day){
if(month == ){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}
}
bool riqi2(ll month,ll day){
if(month< || month>) return false;
if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}
}
bool riqi3(ll month,ll day){
if(month< || month>) return false;
if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}else if(month==){
if(day< || day>) return false;
return true;
}
} bool cal(char *s){
ll year = , month = , day = ;
year = (s[]-'')* + (s[]-'')* + (s[]-'')* +s[]-'';
month = (s[]-'')* + s[]-'';
day = (s[]-'') * + s[]-'';
if(year == ){
if(month> || month<) return false;
if(month==){
if(day< || day>) return false;
return true;
}else if(month == ){
if(day > || day < ) return false;
return true;
}else{
if(riqi(month,day)) return true;
return false;
}
}else if(year == ){
if(riqi2(month,day)) return true;
return false;
}else if(year> && year<){
if((year%==&&year%!=)||(year%==)){
if(riqi2(month,day)) return true;
return false;
}else{
if(riqi3(month,day)) return true;
return false;
}
}else{
return false;
}
} int main()
{
ll t;
scanf("%I64d",&t);
while(t--){
scanf("%I64d",&n);
scanf("%I64d%I64d",&a,&b);
ll ans=;
for(ll i=;i<n;i++){
scanf("%s",s);
if((s[]==s[]) && (s[]==s[]) && (s[]==s[]) && s[]==s[] ){
ans+=a;
}else if(judge(s)){
ans+=a;
}else if(cal(s)){
ans+=a;
}else{
ans+=b;
}
}
printf("%I64d\n",ans);
}
return ;
}

hdu 5611 Baby Ming and phone number(模拟)的更多相关文章

  1. HDU 5611 Baby Ming and phone number

    #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include ...

  2. hdu 5612 Baby Ming and Matrix games(dfs暴力)

    Problem Description These few days, Baby Ming is addicted to playing a matrix game. Given a n∗m matr ...

  3. hdu 5610 Baby Ming and Weight lifting

    Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the weight of which c ...

  4. hdu 5612 Baby Ming and Matrix games

    Baby Ming and Matrix games 题意: 给一个矩形,两个0~9的数字之间隔一个数学运算符(‘+’,’-‘,’*’,’/’),其中’/’表示分数除,再给一个目标的值,问是否存在从一 ...

  5. HDU 5612 Baby Ming and Matrix games(DFS)

    题目链接 题解:题意为给出一个N*M的矩阵,然后(i∗2,j∗2) (i,j=0,1,2...)的点处是数字,两个数字之间是符号,其他位置是‘#’号. 但不知道是理解的问题还是题目描述的问题,数据中还 ...

  6. HDU 5613 Baby Ming and Binary image

    因为第一行和最后一行都是0,我们只需枚举最左边或最右边一列的01情况,即可得到整张表 然后再检验表是否符合要求 #include<cstdio> #include<cstring&g ...

  7. HDU 5614 Baby Ming and Matrix tree 树链剖分

    题意: 给出一棵树,每个顶点上有个\(2 \times 2\)的矩阵,矩阵有两种操作: 顺时针旋转90°,花费是2 将一种矩阵替换为另一种矩阵,花费是10 树上有一种操作,将一条路经上的所有矩阵都变为 ...

  8. hdoj--5611--Baby Ming and phone number(模拟水题)

     Baby Ming and phone number Crawling in process... Crawling failed Time Limit:1500MS     Memory Li ...

  9. BestCoder Round #69 (div.2) Baby Ming and Weight lifting(hdu 5610)

    Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

随机推荐

  1. WebService-相关概念介绍

    WebService学习总结(二)——WebService相关概念介绍 一.WebService是什么? 1. 基于Web的服务:服务器端整出一些资源让客户端应用访问(获取数据) 2. 一个跨语言.跨 ...

  2. HTML之一天学会html(常用标签+网页架构)

    1.  网页文件的创建 新建一个文本文件,将其命名为xxx.html或者xxx.htm(注意后缀名) 2.  简单的html页面的编写 在网页中都是通过标签来指定相应的显示内容,所有的页面内容都必须在 ...

  3. [WebStrom] Cannot detect file change to trigger webpack re-compile

    Working with editors/IDEs supporting “safe write” Note that many editors support “safe write” featur ...

  4. 使用Win32::OLE操作Excel——Excel对象模型

    像VBA操作Excel一样,Win32::OLE模块也是通过对象操作来控制Excel. 如果想自动化操作和控制Excel应用程序,则必须要与Excel对象模型所提供的对象进行交互.理解和熟悉Excel ...

  5. android studio 报ambiguous method call

    如题,在android studio中调用this.toString时,提示的错误信息是ambiguous method call. both get class () in object and g ...

  6. CentOS7--Xshell网络中断引起的vi编辑文件问题

    在编写Python的程序时,由于不小心触碰网线使xshell出现网络中断问题,当再次以vi命令打开文件准备编辑时,发现爆出英文错误: 该错误的英文翻译大概是(1)另一个程序也在编译这个文件,如果是这样 ...

  7. mysql高可用方案MHA介绍

    mysql高可用方案MHA介绍 概述 MHA是一位日本MySQL大牛用Perl写的一套MySQL故障切换方案,来保证数据库系统的高可用.在宕机的时间内(通常10-30秒内),完成故障切换,部署MHA, ...

  8. C# 操作 AppSettings节点

    1.实例 //1.简单获取内容 string value = ConfigurationManager.AppSettings["one"] as string; Console. ...

  9. (转)jQuery插件开发模式

    要说jQuery 最成功的地方,我认为是它的可扩展性吸引了众多开发者为其开发插件,从而建立起了一个生态系统.这好比大公司们争相做平台一样,得平台者得天下.苹果,微软,谷歌等巨头,都有各自的平台及生态圈 ...

  10. .NET 笔试分享

    最近一直在面试,每次面试前也不怎么准备,虽说碰到的题大部分都很简单的,但是在现场答题的时候由于自己紧张脑子就空了,一些题答的不是很好,所以只有每次回来的时候才能好好想想怎么答: 题大部分还是挺简单的, ...