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 ( ...
随机推荐
- mongodb 慢SQL查询
在 MySQL中,慢查询日志是经常作为我们优化数据库的依据,那在MongoDB中是否有类似的功能呢?答案是肯定的,那就是Mongo Database Profiler.不仅有,而且还有一些比MySQL ...
- find tar 压缩第一层目录,用于资料备份。
find *.tar.gz -exec tar zxvf '{}' \;//查找当前目录下的.tar.gz 的文件的 并发送给后面的命令执行find . -maxdepth 1 //查找当前目录下的文 ...
- servlet容器开发要点
v1 是一个http服务器. v2 是一个servlet容器, 可以提供servlet的服务. => 动态load servlet字节码,并运行它( 按生命周期). servlet容器它来 ...
- C++虚函数的新用法
1.今天在segmentfault上看到了一个C++虚函数的新用法,先上代码 #include <iostream> using namespace std; class B { publ ...
- Tab选项卡的原生写法
关键点:建立点击事件和显示事件的连接,即点li 1让对应的div1出来,很容易想到遍历.索引 ;;} ul,li{list-style: none;} .tab{background: rgba(2, ...
- HTML day03表格与表单
1.表格 一般格式: <table> <thead><!--表格头--> <tr> <th></th> </tr>& ...
- shell 各种循环判断
shell支持的循环有 Shell if else Shell case esac Shell for循环 Shell while循环 Shell until循环
- Apache + PHP in Windows XP (to add SQLite)
Firstly, Winxp do not support VC11+, so choose Apache packs compiled under VC10-. Before installatio ...
- HDU 2802 F(N)(简单题,找循环解)
题目链接 F(N) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- struts2中的<s:select>默认选项
//... public class SelectAction extends ActionSupport{ private List<String> searchEngine; priv ...