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 ( ...
随机推荐
- anyremote源码分析
XTest 鼠标移动事件. XTestFakeMotionEvent 关于XTest的编程. http://lilydjwg.is-programmer.com/2011/9/21/using-x ...
- linux 查看 cpu 和内存的命令 - top
1.查看内存,cpu ,当前进程task数目, 每个进程的cpu, 内存使用率, 用top 命令: 在这个页面,按 P,下面的进程排序,以cpu使用率降序排列. 按M,按内存使用率降序排列: 按N, ...
- 关于web.xml的格式
先是filter 再是<filter-mapping> 然后<servlet> 再是<servlet-mapping> 这是一种规范基于j2ee 在开发的过程中一 ...
- 获取Excel部分数据并很据项目要求计算适宜性等级综合指数判断该地区的土壤适宜性
代码运行前请先导入jxl架包,以下代码仅供学习参考: 下图为项目中的Excel: ExcelTest02类代码如下: // 读取Excel的类 import java.io.BufferedWrite ...
- EGL接口介绍-----Android OpenGL ES底层开发
引自:http://www.cnitblog.com/zouzheng/archive/2011/05/30/74326.html EGL 是 OpenGL ES 和底层 Native 平台视窗系统之 ...
- scrollview上面的图片不上下滑动
self.automaticallyAdjustsScrollViewInsets= NO;
- Linux环境下Android JNI程序的编译
尊重原创作者,转载请注明出处: http://blog.csdn.net/gemmem/article/details/8993493 在android开发中,有时候需要编写一些C/C++代码,这时候 ...
- CC_CALLBACK之间的区别
#define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_A ...
- struts2+ajax实现异步验证
由于老师布置作业的需要,在添加管理员的时候,要实现验证添加的管理员的用户名是否在数据库中已经存在,然后再客户端给用户一个提示.我首先想到的就是利用ajax实现异步验证技术,由于利用的ssh框架,所以在 ...
- Windows API 之 InternetOpen、InternetOpenUrl、InternetReadFile
InternetOpen: Initializes an application's use of the WinINet functions. HINTERNET InternetOpen( _In ...