hdu 5611 /BC 69B Baby Ming and phone number
来源:互联网 发布:linux 安装rpm包 编辑:程序博客网 时间:2024/05/17 15:36
直接按照题面描述模拟即可
对于前两条 可以一起判断 差值是否为1,0,-1
对于日期 年在范围内 并且合法即可
对于2月有29天的闰年的定义为 年份 可以被400整除 或者 不能被100整除但能被4整除
#include<iostream>#include<cstdio>#include<cstring>#include<cctype>#include<cmath>#include<vector>#include<queue>#include<map>#include<algorithm>#include<set>#define scnaf scanf#define cahr char#define bug puts("bugbugbug");using namespace std;typedef long long ll;const int mod=1000000007;const int maxn=50+5;const int inf=1e9;const int maxe=200000;char cha[100];int a[100];bool go(){ int nian,yue,ri; nian=a[3]*1000+a[4]*100+a[5]*10+a[6]; yue=a[7]*10+a[8]; ri=a[9]*10+a[10]; if(nian<1980||nian>2016) return 0; if(yue>=1&&yue<=12); else return 0; int maxx=31; if(yue==4||yue==6||yue==9||yue==11) maxx=30; if(yue==2){ if(nian%400==0||(nian%4==0&&nian%100)) maxx=29; else maxx=28; } if(ri<0||ri>maxx) return 0; return 1;}bool ok(){ for(int i=0;i<11;i++) a[i]=cha[i]-'0'; if(go()) return 1; int v=a[7]-a[6]; if(abs(v)>1) return 0; for(int i=7;i<11;i++) if(a[i]-a[i-1]!=v) return 0; return 1;}int main(){ int T_T; scanf("%d",&T_T); int a,b,n; while(T_T--){ ll ans=0; scanf("%d%d%d",&n,&a,&b); for(int i=0;i<n;i++){ scanf("%s",cha); if(ok()) ans+=a; else ans+=b; } printf("%I64d\n",ans); } return 0;}
0 0
- hdu 5611 /BC 69B Baby Ming and phone number
- HDU 5611: Baby Ming and phone number
- Baby Ming and phone number(BC)
- HDU 5611 Baby Ming and phone number(模拟)
- HDU-5611 Baby Ming and phone number(模拟)
- HDU 5611 Baby Ming and phone number(字符串模拟)
- Hdu 5611 Baby Ming and phone number【日期计算等等】
- HDU 5611 Baby Ming and phone number(水~)
- 5611 Baby Ming and phone number
- HDOJ 5611 Baby Ming and phone number
- BestCoder Round #69 (div.2) B HDOJ5611 Baby Ming and phone number(stl)
- hdu 5610 /BC 69A Baby Ming and Weight lifting
- hdu 5612 /BC 69C Baby Ming and Matrix games
- hdu 5613 /BC 69D Baby Ming and Binary image
- HDU 5610/BC 69E Baby Ming and Matrix tree
- hdoj 5611 Baby Ming and phone number 【模拟】
- HDOJ 5611 Baby Ming and phone number(模拟)
- HDOJ 5611 Baby Ming and phone number (模拟)
- ORACLE索引重建分析详解
- jQuery学习之旅 5 $与jQuery对象
- 安卓--第三天--Listview的实现方法详细分析
- HTML5 音乐播放
- 记录,使用RTT+StencilBuffer
- hdu 5611 /BC 69B Baby Ming and phone number
- [IOS 开发] 用多个.m文件实现一个类
- linux(centos)搭建SVN服务器
- ios avaudioPlayer 无声音
- 安卓--第四天--广播接收者和服务
- properties文件Eclipse中文乱码问题
- std::string用法总结
- jQuery学习之旅 6 好用的each()
- 博客搬家