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 ( ...
随机推荐
- asp的RegExp对象正则表达式功能用法
RegExp对象提供简单的正则表达式支持功能. RegExp对象的用法: 以下为引用的内容: Function RegExpTest(patrn, strng) Dim regEx, Match, M ...
- C语言 - pthread
pthread_create函数 原型:int pthread_create((pthread_t *thread, pthread_attr_t *attr, void *(*start ...
- POJ 2975 Nim 尼姆博弈
题目大意:尼姆博弈,求先手必胜的情况数 题目思路:判断 ans=(a[1]^a[2]--^a[n]),求ans^a[i] < a[i]的个数. #include<iostream> ...
- DEAMONTOOLS: installation
installing daemontools .. adding -I /usr/include/errno.h to last first line of conf-cc mkdir -p /pac ...
- PostConstruct注解
应用场景:当你需要往Bean里注入一个其父类中定义的属性,而你又无法复写父类的属性或属性的setter方法时 public class UserDaoImpl extends HibernateDao ...
- robot framework -记录错误
1.注意ie浏览器代理设置,报奇怪的错误 2.注意浏览器的安全设置,保护模式全部不要勾选
- mapreduce 依赖组合
mport java.io.IOException;import java.util.StringTokenizer; import org.apache.hadoop.conf.Configurat ...
- AngularJS 基础用法
判断语句: <li ng-repeat=”person in persons”> <span ng-switch on=”person.sex”> <span ng-sw ...
- Win7下安装配置Java
1 安装JDK java.sun.com 下载 Java SE Development Kit 2 配置环境变量 变量名:JAVA_HOME 变量值:C:\Program Files (x86)\J ...
- CodeForces 83B Doctor
二分查找. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...