Friday the Thirteenth
来源:互联网 发布:template.js helper 编辑:程序博客网 时间:2024/06/08 11:36
USACO成长笔记,不急,慢慢来嘛
/*ID: 13913351LANG: CPROG: friday*/#include<stdio.h>#include<string.h>int week[7];int main(){ FILE *fin = fopen ("friday.in", "r"); FILE *fout = fopen ("friday.out", "w"); memset(week,0,sizeof(week)); int N; int y,m,d;//年 月 日 int w;//星期 int i,j; fscanf(fin,"%d",&N); d=13; for(i=1900;i<=1900+N-1;i++) { int y=i; for(j=1;j<=12;j++) { int m=j; if(m==1||m==2) { m+=12; y--; } w=(y+y/4+y/400-y/100+2*m+3*(m+1)/5+d)%7; //此蔡勒公式公式在1752年9月3日后成立 week[w]++; //week[i]表示 星期 i+1; if(m>12)y++;//一月,二月计算过后表年份的y减1,在后续计算需要恢复 } } fprintf(fout,"%d %d ",week[5],week[6]); for(i=0;i<4;i++) { fprintf(fout,"%d ",week[i]); } fprintf(fout,"%d\n",week[4]); return 0; }
阅读全文
0 0
- Friday the Thirteenth
- Analysis:Friday the Thirteenth
- Friday the Thirteenth(USACO)
- usaco--Friday the Thirteenth
- Friday the Thirteenth
- [USACO] Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- usaco Friday the Thirteenth
- Friday the Thirteenth黑色星期五
- USACO Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- USACO:Friday the Thirteenth
- Friday the Thirteenth
- USACO -Friday the Thirteenth
- 当eclipse跑的不是当前程序
- 神经网络:1)从zero开始的梯度下降法
- 栈(链式)
- JAVA源码解读之StringBuffer
- 计算机组成与系统结构学习笔记(1)一 计算机系统概论 [1.3
- Friday the Thirteenth
- hibernate的二级缓存 I
- STM32F4应用笔记(五)UCGUI+uC/OS-II+支持触摸屏
- 大鱼吃小鱼
- 时域卷积与频域乘积
- 快乐数
- Java集合类HashMap实现原理
- Windows server 2008 性能优化
- Datatable的分页入门