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. 第28讲 UI组件之 ListView和ArrayAdapter

    第28讲 UI组件之 ListView和ArrayAdapter 1. Adapter 适配器 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带.在常见的 ...

  2. php中strstr、strrchr、substr、stristr四个函数的区别总结

    php中strstr.strrchr.substr.stristr四个函数的区别总结 投稿:junjie 字体:[增加 减小] 类型:转载 时间:2014-09-22我要评论 这篇文章主要介绍了php ...

  3. HDU 2025 查找最大元素

    查找最大元素 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submis ...

  4. POJ2151Check the difficulty of problems 概率DP

    概率DP,还是有点恶心的哈,这道题目真是绕,问你T个队伍.m个题目.每一个队伍做出哪道题的概率都给了.冠军队伍至少也解除n道题目,全部队伍都要出题,问你概率为多少? 一開始感觉是个二维的,然后推啊推啊 ...

  5. 多路复用I/O select()

    select(),poll(),epoll()的总结:http://www.cnblogs.com/Anker/p/3265058.html 在socket编程中,仅仅使用connect,accept ...

  6. CentOS6.6(单用户模式)重设root密码

    1.开机时手要快按任意键,因为默认时间5s 2.grub菜单,只有一个内核,没什么好上下选的,按e键.不过如果你升级了系统或安装了Xen虚拟化后,就会有多个显示了. 3.接下来显示如下,选择第二项,按 ...

  7. sqlserver插入datetime

    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")

  8. PowerDesigner与UML建模应用

    一.   PD简介 PowerDesigner 是一个集所有现代建模技术于一身的完整工具,它集成了强有力的业务建模技术.传统的数据库分析和实现,以及UML对象建模.通过了元数据的管理.冲突分析和真正的 ...

  9. sql语句的分类

    这些天在看Oracle database 11g SQL开发指南,关于sql语句的分类,感觉有必要记录一下. sql语句主要分五类: DML(DATA MANIPULATION LANGUAGE, 数 ...

  10. CC开发问题一

    CC编译成功,启动失败,debug状态下报错如下,未能加载文件或程序集 这个问题查了一些资料,http://blog.csdn.net/shellching/article/details/82947 ...