hdoj--5611--Baby Ming and phone number(模拟水题)
来源:互联网 发布:轩辕剑神魔进阶数据 编辑:程序博客网 时间:2024/06/05 23:45
Baby Ming and phone number
Crawling in process...Crawling failedTime Limit:1500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
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.
1.The last five numbers are the same. (such as 123-4567-7777)
2.The last five numbers are successive increasing or decreasing, and the diffidence between two adjacent digits is $1$. (such as 188-0002-3456)
3.The last eight numbers are a date number, the date of which is between Jar 1st, 1980 and Dec 31th, 2016. (such as 188-1888-0809,means August ninth,1888)
Baby Ming wants to know how much he can earn if he sells all the numbers.
He thinks normal number can be sold for $b$ yuan, while number with following features can be sold for $a$ yuan.
1.The last five numbers are the same. (such as 123-4567-7777)
2.The last five numbers are successive increasing or decreasing, and the diffidence between two adjacent digits is $1$. (such as 188-0002-3456)
3.The last eight numbers are a date number, the date of which is between Jar 1st, 1980 and Dec 31th, 2016. (such as 188-1888-0809,means August ninth,1888)
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 $2$ 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|==11, the first number can’t be 0)
$1 \leq T \leq 30, b < 1000, 0 < a, n \leq 100,000$
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 $2$ 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|==11, the first number can’t be 0)
$1 \leq T \leq 30, b < 1000, 0 < a, n \leq 100,000$
Output
How much Baby Nero can earn.
Sample Input
15100000 10001231999021211111111111222222234561002222111132165491212
Sample Output
302000#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int main(){int t;scanf("%d",&t);while(t--){int n;cin>>n;char str[1010];__int64 ans=0;__int64 a,b;scanf("%lld%lld",&a,&b);for(int i=0;i<n;i++){memset(str,'\0',sizeof(str));bool f=false;scanf("%s",str);for(int i=0;i<11;i++)str[i]-='0';if(str[10]==str[9]&&str[10]==str[8]&&str[10]==str[7]&&str[10]==str[6])f=true;else if(str[6]+1==str[7]&&str[7]+1==str[8]&&str[8]+1==str[9]&&str[9]+1==str[10])f=true;else if(str[6]-1==str[7]&&str[7]-1==str[8]&&str[8]-1==str[9]&&str[9]-1==str[10])f=true;int year=str[3]*1000+str[4]*100+str[5]*10+str[6];int mon=str[7]*10+str[8];int day=str[9]*10+str[10];if(year>=1980&&year<=2016){if(mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12){if(day<=31)f=true;}if(mon==4||mon==6||mon==9||mon==11){if(day<=30)f=true;}if(mon==2&&day<=28)f=true;if((year%4==0&&year%100!=0)||year%400==0)if(mon==2&&day==29)f=true;}if(f)ans+=a;elseans+=b;}printf("%lld\n",ans);}return 0;}
0 0
- HDOJ 5611 Baby Ming and phone number (模拟)
- hdoj 5611 Baby Ming and phone number(模拟)
- hdoj--5611--Baby Ming and phone number(模拟水题)
- hdoj 5611 Baby Ming and phone number 【模拟】
- HDOJ 5611 Baby Ming and phone number(模拟)
- HDOJ 5611-Baby Ming and phone number【模拟】
- HDOJ 5611 Baby Ming and phone number
- HDOJ--5611(Baby Ming and phone number)(闰年)
- hdoj Baby Ming and phone number 5611 (简单判断)
- HDU 5611 Baby Ming and phone number(模拟)
- HDU-5611 Baby Ming and phone number(模拟)
- HDU 5611 Baby Ming and phone number(字符串模拟)
- HDU 5611 Baby Ming and phone number(水~)
- HDU 5611: Baby Ming and phone number
- 5611 Baby Ming and phone number
- Baby Ming and phone number(BC)
- 【Best Coder】Baby Ming and phone number(水)
- hdu 5611 /BC 69B Baby Ming and phone number
- shell特殊符号及变量
- ASP.NET 连接数据库 增删改查简单实例
- Hadoop HDFS NFS GateWay部署深入详解
- TCP的运输连接管理(3次握手,4次握手)
- JSP 如何使验证码文件 点击刷新效果
- hdoj--5611--Baby Ming and phone number(模拟水题)
- JavaScript
- shell命令-test
- 绝对值函数与最大值/最小值函数之间的关系_20160305
- 在Java中如何高效的判断数组中是否包含某个元素
- C++实验1-三个整数输出最大值
- Hadoop一些比较杂的知识点
- eclipse 使用git 上传到github
- 斯大林名言(34句)