HDU 5611 Baby Ming and phone number
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<list>
#include<algorithm>
using namespace std; int T,n;
char s[];
long long a,b;
int q1[],q2[]; long long f()
{
if(s[]==s[]&&s[]==s[]&&s[]==s[]&&s[]==s[]) return a;
bool fail=;
for(int i=;i<=;i++) if(s[i]-s[i-]!=) fail=;
if(fail==) return a;
fail=;
for(int i=;i<=;i++) if(s[i]-s[i-]!=-) fail=;
if(fail==) return a; int year=(s[]-'')*+(s[]-'')*+(s[]-'')*+(s[]-'');
int month=(s[]-'')*+(s[]-'');
int day=(s[]-'')*+(s[]-''); if(year>=&&year<=)
{
if(month>=&&month<=)
{
if( (( == year%)&&( != year%)) ||( == year %) )
{
if(day>=&&day<=q2[month]) return a;
}
else
{
if(day>=&&day<=q1[month]) return a;
}
}
}
return b;
} int main()
{
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=;
q1[]=; q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
q2[]=;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
scanf("%lld%lld",&a,&b);
long long ans=;
for(int i=;i<=n;i++)
{
scanf("%s",s);
ans=ans+f();
}
printf("%lld\n",ans);
}
return ;
}
HDU 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 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 ( ...
随机推荐
- ubuntu 安装LNMP
How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04 PostedJune 13, 2012 802.8kviews ...
- JNI调用问题(部分机型崩溃)
1.今日测试发现在部分手机上游戏会崩溃,通过logcat日志发现是jni调用问题(我猜测) 错误日志中有如下语句: trying to work around app JNI bugs, but di ...
- layer属性
键: 值 描述 下表的属性都是默认值,您可在调用时按需重新配置,他们可帮助你实现各式各样的风格.如是调用: $.layer({键: 值, 键: 值, -}); type: 0 层的类型.0:信息框(默 ...
- MFC笔记<持续更新>
1.设置垂直滚动条的位置在末尾 SCROLLINFO si; GetScrollInfo(SB_VERT, &si, SIF_PAGE | SIF_RANGE | SIF_POS); si.f ...
- std::function 测试
#ifndef __HELLOWORLD_SCENE_H__ #define __HELLOWORLD_SCENE_H__ #include "cocos2d.h" typedef ...
- 九宫格问题 A*
八数码问题 一.八数码问题八数码问题也称为九宫问题.在3×3的棋盘,摆有八个棋子,每个棋子上标有1至8的某一数字,不同棋子上标的数字不相同.棋盘上还有一个空格,与空格相邻的棋子可以移到空格中.要求解决 ...
- Light OJ 1006 - Hex-a-bonacci
题目链接:http://acm.hust.edu.cn/vjudge/contest/121396#problem/G http://lightoj.com/volume_showproblem.ph ...
- 用cas来实现php的单点登陆
最近项目中需要做单点登录,客户端包含Java.ruby和PHP,java有几个应用程序,php是discuz+supesite+ucenter,配置步骤如下: 1.cas服务端:下载地址:http:/ ...
- 微信小程序Server端环境配置
主要内容:1. SSL免费证书申请步骤2. Nginx HTTPS 配置3. TLS 1.2 升级过程 微信小程序要求使用 https 发送请求,那么Web服务器就要配置成支持 https,需要先申请 ...
- CF 672 div2 D
http://codeforces.com/contest/672/problem/D 题目大意: 有n个人,每个人有pi的钱,然后可以由如下操作,每次都可以挑选一个最富有的人,把它的钱给最穷的人.但 ...