hdoj--5611--Baby Ming and phone number(模拟水题)
Baby Ming and phone number
Crawling in process...
Crawling failed
Time Limit:1500MS
Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Description
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 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
Sample Input
1
5
100000 1000
12319990212
11111111111
22222223456
10022221111
32165491212
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;
else
ans+=b;
}
printf("%lld\n",ans);
}
return 0;
}
hdoj--5611--Baby Ming and phone number(模拟水题)的更多相关文章
- hdu 5611 Baby Ming and phone number(模拟)
Problem Description Baby Ming collected lots of cell phone numbers, and he wants to sell them for mo ...
- HDU 5611 Baby Ming and phone number
#include<cstdio> #include<cstring> #include<vector> #include<cmath> #include ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- POJ 2014:Flow Layout 模拟水题
Flow Layout Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3091 Accepted: 2148 Descr ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- Codeforces Round #350 (Div. 2) F. Restore a Number 模拟构造题
F. Restore a Number Vasya decided to pass a very large integer n to Kate. First, he wrote that num ...
- HDOJ 1008. Elevator 简单模拟水题
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- CodeForces 689A Mike and Cellphone (模拟+水题)
Mike and Cellphone 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/E Description While sw ...
- UVA 10714 Ants 蚂蚁 贪心+模拟 水题
题意:蚂蚁在木棍上爬,速度1cm/s,给出木棍长度和每只蚂蚁的位置,问蚂蚁全部下木棍的最长时间和最短时间. 模拟一下,发现其实灰常水的贪心... 不能直接求最大和最小的= =.只要求出每只蚂蚁都走长路 ...
随机推荐
- time模块,补上之前拉下的作业。
time,时间模块比较重要,但不难学,主要是要学会转换时间格式.计算机的时间都是时间戳.人是看不懂的.写出时间转换的固定格式语句.import time # 首先就是引入时间模块. time.ti ...
- LinuxMint19.1安装搜狗拼音输入法
Installation 1.到搜狗拼音输入法官网下载Linux版. 2.使用dpkg命令安装deb软件包 $ sudo dpkg -i sogoupinyin_2.2.0.0108_amd.deb ...
- linux ifstat-统计网络接口流量状态
推荐:更多linux 性能监测与优化 关注:linux命令大全 ifstat命令就像iostat/vmstat描述其它的系统状况一样,是一个统计网络接口活动状态的工具.ifstat工具系统中并不默认安 ...
- 腾讯云:基于 Ubuntu 搭建 VNC 远程桌面服务
基于 Ubuntu 搭建 VNC 远程桌面服务 前言 任务时间:5min ~ 10min 必要知识 本教程假设您已学习以下 Ubuntu 基本操作: 连接 SSH 执行命令 编辑文件 如果还没有掌握 ...
- ganglia371 on suse11sp3
参考https://my.oschina.net/duangr/blog/181585 1.确认依赖包是否已安装 确认命令:rpm -qa 如下为适合suse11sp3的依赖包版本 apr: lib ...
- hdu 5023 线段树延迟更新+状态压缩
/* 线段树延迟更新+状态压缩 */ #include<stdio.h> #define N 1100000 struct node { int x,y,yanchi,sum; }a[N* ...
- vue.js组件之间通讯--父组件调用子组件的一些方法,子组件暴露一些方法,让父组件调用
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 洛谷—— P3811 【模板】乘法逆元
https://www.luogu.org/problem/show?pid=3811 题目背景 这是一道模板题 题目描述 给定n,p求1~n中所有整数在模p意义下的乘法逆元. 输入输出格式 输入格式 ...
- docker mysql 主从配置
docker安装运行单实例的MySQL参考另一篇文档 http://www.cnblogs.com/manger/p/7611309.html 1.首先在/data/script下创建两个文件my-m ...
- CentOS设置程序开机启动程序/服务的方法(转)
注意:CentOS 6下基本没什么问题,CentOS 7估计不一定能行. 在CentOS系统下,主要有两种方法设置自己安装的程序开机启动. 1.把启动程序的命令添加到/etc/rc.d/rc.loca ...