HDU-5611 Baby Ming and phone number(模拟)
来源:互联网 发布:德客会员管理系统源码 编辑:程序博客网 时间:2024/06/04 20:10
Baby Ming and phone number
http://acm.hdu.edu.cn/showproblem.php?pid=5611
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
水题,按照题意判断即可
忘了0开头的数字表示8进制,01234导致数字错误,浪费好长时间
#include <cstdio>using namespace std;const int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};const int fea[22]={ 0,11111,22222,33333,44444,55555,66666,77777,88888,99999, 1234,12345,23456,34567,45678,56789, 98765,87654,76543,65432,54321,43210};int T,n;long long number,ans,a,b;inline bool isSpic(int num) { for(int i=0;i<22;++i) if(num==fea[i]) return true; return false;}inline int isleap(int year) { if((year%4==0&&year%100!=0)||year%400==0) return 1; return 0;}bool isDate(int year,int month,int day) { if(year<1980||year>2016||month==0||month>12||day==0) return false; if(month==2) { if(day>28+isleap(year)) return false; return true; } if(day>days[month]) return false; return true;}int main() { scanf("%d",&T); while(T--) { ans=0; scanf("%d%I64d%I64d",&n,&a,&b); while(n--) { scanf("%I64d",&number); ans+=(isSpic(number%100000)||isDate((number/10000)%10000,(number/100)%100,number%100))?a:b; } printf("%I64d\n",ans); } return 0;}
0 0
- 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
- HDOJ 5611 Baby Ming and phone number (模拟)
- hdoj 5611 Baby Ming and phone number(模拟)
- HDU 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【模拟】
- hdu 5611 /BC 69B Baby Ming and phone number
- Hdu 5611 Baby Ming and phone number【日期计算等等】
- 5611 Baby Ming and phone number
- HDOJ 5611 Baby Ming and phone number
- Baby Ming and phone number(BC)
- hdoj--5611--Baby Ming and phone number(模拟水题)
- HDOJ--5611(Baby Ming and phone number)(闰年)
- hdoj Baby Ming and phone number 5611 (简单判断)
- Linux目录遍历实现 -- 列出当前目录下所有文件
- 树定义
- hibernate.cfg.xml
- 记CentOS 7环境下安装g++
- 叠加曲线图表定义
- HDU-5611 Baby Ming and phone number(模拟)
- quartz定时任务配置实例
- HMM->MEMM->CRF
- poj 2828 Buy Tickets(线段树)
- 机器学习系列01——机器学习需要这些数学知识
- Java-集合框架Collection之Set(一)
- Ashes of Time
- 柱状图表定义
- 我一直把html视频音频放在二级域名,现在放到目录竟发现很多新问题没解决?