hdoj5611Baby Ming and phone number
来源:互联网 发布:北航 英语专业的 知乎 编辑:程序博客网 时间:2024/06/05 11:43
Baby Ming and phone number
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 685 Accepted Submission(s): 202
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 forb 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 is1 . (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
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
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 integern , which means how many numbers Baby Ming has.(no two same phone number)
In the third line there are2 positive integers a,b , which means two kinds of phone number can sell a yuan and b yuan.
In the nextn lines there are n cell phone numbers.(|phone number|==11, the first number can’t be 0)
1≤T≤30,b<1000,0<a,n≤100,000
In the second line there is a positive integer
In the third line there are
In the next
Output
How much Baby Nero can earn.
Sample Input
15100000 10001231999021211111111111222222234561002222111132165491212
Sample Output
302000
Source
BestCoder Round #69 (div.2)
Recommend
hujie | We have carefully selected several similar problems for you: 5614 5613 5612 5609 5608
#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<cmath>#include<map>#include<queue>using namespace std;const int maxn=10010;char str[15];int mov[15]={0,31,28,31,30,31,30,31,31,30,31,30,31};int main(){ int t,i,j,k,n; long long a,b,c,ans; scanf("%d",&t); while(t--){ scanf("%d%lld%lld",&n,&a,&b);ans=0; for(j=0;j<n;++j){ scanf("%s",str+1); bool flag1=true,flag2=true,flag3=true; for(i=7;i<=11;++i){ if(str[i]!=str[7])flag1=false; if((str[i]-str[7])!=(i-7))flag2=false; if((str[i]-str[7])!=(7-i))flag3=false; } int y=(str[4]-'0')*1000+(str[5]-'0')*100+(str[6]-'0')*10+(str[7]-'0'); int m=(str[8]-'0')*10+str[9]-'0'; int d=(str[10]-'0')*10+str[11]-'0'; bool flag4=false; if(y>=1980&&y<=2016){ if(m>=1&&m<=12){ if((y%4==0&&y%100!=0)||y%400==0){ mov[2]++; if(d>=1&&d<=mov[m])flag4=true; mov[2]--; } else if(d>=1&&d<=mov[m])flag4=true; } } if(flag1||flag2||flag3||flag4)ans+=a; else ans+=b; } printf("%lld\n",ans); } return 0;}
0 0
- hdoj5611Baby Ming and phone number
- Baby Ming and phone number(BC)
- HDU 5611: Baby Ming and phone number
- hdu5611 Baby Ming and phone number
- 5611 Baby Ming and phone number
- HDOJ 5611 Baby Ming and phone number
- HDU5611 Baby Ming and phone number 水题
- 【Best Coder】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 /BC 69B Baby Ming and phone number
- HDOJ 5611-Baby Ming and phone number【模拟】
- HDU-5611 Baby Ming and phone number(模拟)
- BestCoder #69 Baby Ming and phone number(HDOJ5611)
- HDU 5611 Baby Ming and phone number(字符串模拟)
- poj1511 Invitation Cards(最短路)
- Ubuntu软件包管理
- jqpagination动态赋值实例
- android的命令行
- TCP慢启动、拥塞避免、快速重传、快速回复
- hdoj5611Baby Ming and phone number
- 两个事物 update同一张表出现的死锁问题
- Cpu Cache对程序性能分析
- 【C#】延迟加载
- hdu 1037 Keep on Truckin'
- 数据库的创建
- Mesos入门介绍
- HDU 5613 Baby Ming and Binary image(扫雷地图的还原)
- SQL Server中NULL的正确使用与空间占用