UVALive 7337 Counting Weekend Days【水题】
来源:互联网 发布:python 日期加减 月份 编辑:程序博客网 时间:2024/05/18 00:31
题目链接
/* 题意:给你一个月份和这个月份的第一个星期几,问你有几个星期六日 类型:模拟 分析:简单模拟,打表日期不小心WA了一次QAQ*/#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;int shu[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int main(){ int t; scanf("%d",&t); for(int ii=1;ii<=t;ii++){ char m[20]; char day[20]; scanf("%s%s",m,day); int month; int dday; if(m[0]=='J'&&m[1]=='A'&&m[2]=='N')month=1; if(m[0]=='F'&&m[1]=='E'&&m[2]=='B')month=2; if(m[0]=='M'&&m[1]=='A'&&m[2]=='R')month=3; if(m[0]=='A'&&m[1]=='P'&&m[2]=='R')month=4; if(m[0]=='M'&&m[1]=='A'&&m[2]=='Y')month=5; if(m[0]=='J'&&m[1]=='U'&&m[2]=='N')month=6; if(m[0]=='J'&&m[1]=='U'&&m[2]=='L')month=7; if(m[0]=='A'&&m[1]=='U'&&m[2]=='G')month=8; if(m[0]=='S'&&m[1]=='E'&&m[2]=='P')month=9; if(m[0]=='O'&&m[1]=='C'&&m[2]=='T')month=10; if(m[0]=='N'&&m[1]=='O'&&m[2]=='V')month=11; if(m[0]=='D'&&m[1]=='E'&&m[2]=='C')month=12; if(day[0]=='S'&&day[1]=='U')dday=7; if(day[0]=='M')dday=1; if(day[0]=='T'&&day[1]=='U')dday=2; if(day[0]=='W')dday=3; if(day[0]=='T'&&day[1]=='H')dday=4; if(day[0]=='F')dday=5; if(day[0]=='S'&&day[1]=='A')dday=6; int sum=0; for(int i=1;i<=shu[month];i++){ if(dday==5||dday==6){ sum++; //printf("*%d*",i); } if(dday==7)dday=1; else dday++; } printf("%d\n",sum); } return 0;}
0 0
- UVALive 7337 Counting Weekend Days【水题】
- UVAlive 5971 Permutation Counting
- UVALive 6527 Counting ones
- UVALive 3295 Counting Triangles
- uvalive 5092 - Permutation Counting
- Permutation Counting HDU3664 UVALive
- Weekend.
- weekend
- weekend
- weekend
- UVALive 6602 Counting Lattice Squares
- 【瞎搞】 UVALive 6527 Counting ones
- UVALive 3295 Counting Triangles(组合计数)
- UVAlive 5971 Permutation Counting(数论 dp)
- UVALive 6602Counting Lattice Squares 【几何】【机智】
- UVALive 6527 Counting ones dfs(水
- HDOJ 3664 Permutation Counting / UVALive 5092 DP
- days
- java多线程学习(二)
- 制作MacOS系统安装U盘,安装Mac OS X,使用Bootcamp安装Windows系统
- linux目录结构
- 【C/C++开发】C语言 DLL(动态链接库)中申请动态内存释放的问题
- SVN 常见问题解决
- UVALive 7337 Counting Weekend Days【水题】
- 1508-张晨曦总结《2016年-10月-25日》【连续4天总结】
- Hibernate缓存
- swift 可选型的实际使用
- unity热更方案 java script binding中使用protobuff(二)
- 利用软引用和引用队列构建软引用缓存
- PHP服务器配置之加载硬盘
- Android TV开发总结(五)TV上屏幕适配总结
- Android艺术开发探索——第二章:IPC机制(下)