hdu 5611 Baby Ming and phone number(模拟)
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.
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≤,
How much Baby Nero can earn.
判断日期的时候比较麻烦,也懒得去优化了,还有会爆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(模拟)的更多相关文章
- HDU 5611 Baby Ming and phone number
#include<cstdio> #include<cstring> #include<vector> #include<cmath> #include ...
- 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 ...
- 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 ...
- hdu 5612 Baby Ming and Matrix games
Baby Ming and Matrix games 题意: 给一个矩形,两个0~9的数字之间隔一个数学运算符(‘+’,’-‘,’*’,’/’),其中’/’表示分数除,再给一个目标的值,问是否存在从一 ...
- HDU 5612 Baby Ming and Matrix games(DFS)
题目链接 题解:题意为给出一个N*M的矩阵,然后(i∗2,j∗2) (i,j=0,1,2...)的点处是数字,两个数字之间是符号,其他位置是‘#’号. 但不知道是理解的问题还是题目描述的问题,数据中还 ...
- HDU 5613 Baby Ming and Binary image
因为第一行和最后一行都是0,我们只需枚举最左边或最右边一列的01情况,即可得到整张表 然后再检验表是否符合要求 #include<cstdio> #include<cstring&g ...
- HDU 5614 Baby Ming and Matrix tree 树链剖分
题意: 给出一棵树,每个顶点上有个\(2 \times 2\)的矩阵,矩阵有两种操作: 顺时针旋转90°,花费是2 将一种矩阵替换为另一种矩阵,花费是10 树上有一种操作,将一条路经上的所有矩阵都变为 ...
- hdoj--5611--Baby Ming and phone number(模拟水题)
Baby Ming and phone number Crawling in process... Crawling failed Time Limit:1500MS Memory Li ...
- 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 ( ...
随机推荐
- Cannot find class in classpath 报错
删除项目文件夹下的target文件夹里面内容,重新运行测试代码,报错 org.testng.TestNGException: Cannot find class in classpath: com.f ...
- servlet下载,解决文件名中有中文下载路径出现乱码不能正常下载问题
方法很多种,我只试用了两种. 主页面JSP中引入下载功能所需的js文件.引入的时候设置编码格式例如 <script type="text/javascript" charse ...
- IIS PHP 配置 问题总结
今天帮助朋友解决一个IIS配置PHP的问题.大概是这样子的. IIS 与 PHP配置好了之后不能訪问,出现例如以下错误: HTTP 错误 500.19 - Internal Server Error ...
- 关于时间的操作(JavaScript版)——年月日三级级联(默认依次显示请选择年、请选择月和请选择日)
这篇博客和前一篇博客基本同样,仅仅是显示的默认值不同: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN&quo ...
- css布局详解(二)——标准流布局(Nomal flow)
css标准流布局(Nomal flow) 一.正常流 这是指西方语言中文本从左向右,从上向下显示,这也是我们熟悉的传统的HTML文档中的文本布局.注意,在非西方的语言中,流方向可能不同.大多数元素都在 ...
- 关于IE11
最近,一个开发代号为Windows Blue的Windows操作系统泄漏到了互联网上,该操作系统的内置浏览器为IE11,本文将介绍一下这个泄漏版的IE11中有哪些关键的新变化和新特性. 预先声明: 本 ...
- FpSpread添加表头(列名)标注
for (int j = 0; j < fp.ActiveSheetView.ColumnCount; j++) { fp.ActiveSheetView.ColumnHeader.Cells[ ...
- .NET中应用Ueditor(富文本编辑)的配置和使用
一.Ueditor的下载 1.百度编辑器下载地址:http://ueditor.baidu.com/website/download.html 2.下载完整源码包,解压到任意目录,解压后的源码目录结构 ...
- unity绘制线和绘制面
绘制线条代码,其实就是指定至少两个点,然后赋予贴图即可,不废话,上代码: using UnityEngine; using System.Collections; public class LineT ...
- [转载]opencv +linux
转载 ubuntu12.04安装openCV2.4.2(2012-08-08 16:54:06 参考http://www.samontab.com/web/2012/06/installing-ope ...