SGU 115 Calendar (模拟)
来源:互联网 发布:打开淘宝网 编辑:程序博客网 时间:2024/04/30 06:50
time limit per test: 0.5 sec.
memory limit per test: 4096 KB
http://acm.sgu.ru/problem.php?contest=0&problem=115
First year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the week for any date in 2001.
Input
Input is a line with two positive integer numbers N and M, where N is a day number in month M. N and M is not more than 100.
Output
Write current number of the day of the week for given date (Monday – number 1, … , Sunday – number 7) or phrase “Impossible” if such date does not exist.
Sample Input
21 10
Sample Output
7
water.
完整代码:
/*15ms,839KB*/#include<cstdio>const int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int sum[20];int main(void){for (int i = 1; i <= 12; ++i)sum[i] = sum[i - 1] + day[i];int n, m;scanf("%d%d", &n, &m);if (m > 12 || n > day[m])puts("Impossible");else{int ans = (sum[m - 1] + n) % 7;printf("%d", ans ? ans : 7);}return 0;}
- SGU 115 Calendar (模拟)
- SGU 115 Calendar
- sgu 115 Calendar
- sgu 115 Calendar
- SGU 115 Calendar
- SGU 115 Calendar
- SGU 115 Calendar(水~)
- SGU - 115 - Calendar (基础题!)
- [SGU]115. Calendar
- SGU 115. Calendar
- 【SGU】115. Calendar 水题= =
- SGU 115. Calendar (基姆拉尔森公式)
- SGU 257 Debt 贪心 + 模拟
- SGU 127 Telephone directory (模拟)
- SGU 239 Minesweeper 模拟题
- POJ 1008-Maya Calendar-模拟
- POJ 1008 Maya Calendar (模拟)
- ZJU1024-Calendar Game(模拟)
- HDU Candy(数学 组合)
- linux kernel map -- 一张非常经典的linux内核地图
- py2exe使用总结
- 正则表达式
- LinkedHashSet类
- SGU 115 Calendar (模拟)
- 安卓刷机及刷机包制作教程
- OpenGL入门学习
- java验证码组件Jcaptcha
- ARP详解
- Android 代码中实现WAP方式联网
- IOCTL函数
- 百度地图的application类型转换错误
- 什么是重载?(最文艺的理解)