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. (转)iOS7界面设计规范(2) - UI基础 - iOS应用解析

    今天再来一发,然后结束掉周六的忙碌,去吃零食,还有冰啤酒:其实现在打嗝还有小龙虾味儿呢. 第二篇更多的是从技术的角度对iOS界面组成原理进行了简单的解析,篇幅很短,可稍作了解:更多关于iOS开发入门的 ...

  2. JSON解析---初识

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式 全然独立于语言的文本格式 易于人阅读和编写 易于解析和生成 (网络传输速度快) JSON语法规则 数据在 ...

  3. android布局属性具体解释

    RelativeLayout用到的一些重要的属性: 1:LinearLayout ( 线性布局 ) (里面仅仅能够有一个控件,而且不能设计这个控件的位置,控件会放到左上角) 线性布局分为水平线性和垂直 ...

  4. Ubuntu下访问SSH

    ssh程序分为有客户端程序openssh-client和服务端程序openssh-server.如果需要ssh登陆到别的电脑,需要安装openssh-client,该程序ubuntu是默认安装的.而如 ...

  5. [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 ...

  6. python应用之文件属性浏览

    import time,os def showFilePROPERTIES(path): for root,dirs,files in os.walk(path,True): print('位置:' ...

  7. 代码,显示IPhone剩余磁盘空间

    #include <sys/mount.h> //这段代码示范怎么取得 iPhone 的剩余磁盘空间,还有全部磁盘空间 long long freeSpace() { struct sta ...

  8. VS2015 新Web项目(C#6)出现CS1617异常的解决

    VS2015 新Web项目(C#6)出现CS1617错误的解决 VS2015新增了对C#6的支持. 在新的Web项目模板中通过引入nuget包Microsoft.CodeDom.Providers.D ...

  9. iOS8怎么降级到iOS7,苹果iOS8怎么刷回iOS7

    iOS8怎么降级到iOS7,苹果iOS8怎么刷回iOS7 http://jingyan.baidu.com/article/e75aca855c5c19142edac6e9.html 威锋APPLE工 ...

  10. .net 4.0 面向对象编程漫谈基础篇读书笔记

    话说笔者接触.net 已有些年头,做过的项目也有不少,有几百万的,也有几十万的,有C/S的,也有B/S的.感觉几年下来,用过的框架不少,但是.net的精髓一直没有掌握.就像学武之人懂得各种招式,但内功 ...