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 ( ...
随机推荐
- Oracle 锁
select for update对某行加锁之后: select语句可以执行: select for update 这行不可以: 会一直等待锁释放 select for update wait 3 ...
- make 命令执行时,报错“missing separator stop”
在Makefile文件中,命令必须以[tab]键开始.
- 导出Excel数据
先要导入jxl架包,其中的abc.xls为测试Excel,具体代码如下,仅供参考: import java.io.File; import java.io.FileInputStream; impor ...
- CodeForces 709B Checkpoints 模拟
题目大意:给出n个点的坐标,和你当前的坐标,求走过n-1个点的最短路程. 题目思路:走过n-1个点,为了使路程更短,那么不走的点只可能第一个点或最后一个点.模拟就行了,比较恶心. #include&l ...
- MFC DLL中导出函数模板
//my.h struct AFX_EXT_CLASS B { }; struct AFX_EXT_CLASS C { }; class AFX_EXT_CLASS A { public: templ ...
- publish over ssh
http://stackoverflow.com/questions/22158092/jenkins-transferring-0-files-using-publish-over-ssh-plug ...
- js框架——angular.js(6)
1. ng-class 这个指令是用来绑定一个或者多个css代码.它的值一般是一个表达式,也可以是函数什么的,只要返回的确实是一个类的名字就可以—— ng-class="nextPageDi ...
- 简单时钟——css3
这里我们使用css3的特性制作一个简易的时钟,代码如下: <!DOCTYPE html><html> <head> <meta charset="U ...
- cocos2d-x 3.x随机数
1.使用标准库std::rand()函数 rand();//产生0~RAND_MAX(0x7fff=32767)间的int类型随机数 rand()%;//产生0~5间的int类型随机数,不包括5 2. ...
- HDU - 1865 1string(大数)
题目链接:http://acm.hust.edu.cn/vjudge/contest/121397#problem/F http://acm.hdu.edu.cn/showproblem.php?pi ...