ZOJ3785 What day is that day?(找循环节)
来源:互联网 发布:jetbrains golang 编辑:程序博客网 时间:2024/05/22 23:25
It's Saturday today, what day is it after 11 + 22 + 33 + ... + NN days?
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
There is only one line containing one integer N (1 <= N <= 1000000000).
Output
For each test case, output one string indicating the day of week.
Sample Input
212
Sample Output
SundayThursday
Hint
A week consists of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday.
底数%7 指数为1,2…时找到的循环
将(i^i)%7打表得到42一循环的数列
将ans打表转换为星期制输出
#include<stdio.h>int t[300]={0,1,5,4,1,4,5,5,6,0,4,6,0,6,6,0,2,0,1,6,0,0,1,5,6,3,0,6,6,0,1,4,6,5,6,6,0,2,4,5,0,6,6,0,4,3,0,3,4,4,5,6,3,5,6,5,5,6,1,6,0,5,6,6,0,4,5,2,6,5,5,6,0,3,5,4,5,5,6,1,3,4,6,5,5,6,3,2,6,2,3,3,4,5,2,4,5,4,4,5,0,5,6,4,5,5,6,3,4,1,5,4,4,5,6,2,4,3,4,4,5,0,2,3,5,4,4,5,2,1,5,1,2,2,3,4,1,3,4,3,3,4,6,4,5,3,4,4,5,2,3,0,4,3,3,4,5,1,3,2,3,3,4,6,1,2,4,3,3,4,1,0,4,0,1,1,2,3,0,2,3,2,2,3,5,3,4,2,3,3,4,1,2,6,3,2,2,3,4,0,2,1,2,2,3,5,0,1,3,2,2,3,0,6,3,6,0,0,1,2,6,1,2,1,1,2,4,2,3,1,2,2,3,0,1,5,2,1,1,2,3,6,1,0,1,1,2,4,6,0,2,1,1,2,6,5,2,5,6,6,0,1,5,0,1,0,0,1,3,1,2,0,1,1,2,6,0,4,1,0,0,1,2,5,0,6,0,0,1,3,5,6,1,0,0};int main(){ int cas,n,ans; scanf("%d",&cas); while(cas--) { scanf("%d",&n); ans=t[n%294]; if(ans==1) printf("Sunday\n"); else if(ans==2) printf("Monday\n"); else if(ans==3) printf("Tuesday\n"); else if(ans==4) printf("Wednesday\n"); else if(ans==5) printf("Thursday\n"); else if(ans==6) printf("Friday\n"); else printf("Saturday\n"); } return 0;}
0 0
- ZOJ3785 What day is that day?(找循环节)
- ZOJ3785:What day is that day?
- zoj3785 What day is that day?
- ZOJ3785-What day is that day?
- ZOJ 3785What day is that day?(循环节找规律)
- ZOJ3785 What day is that day?(同余与模算术)
- ZOJ 3785 What day is that day? 循环节找规律
- ZOJ 3785 What day is that day? (找规律)
- ZOJ 3785What day is that day?(最小循环节)
- ZOJ 3785 What day is that day?(费马小定理智寻循环节)
- ZOJ 3785 What day is that day? (数论 循环节)
- What day is that day?
- What day is that day?
- What day is that day?
- ZOJ What day is that day? (找最小周期)
- zoj 3785 What day is that day?(找规律,KMP)
- ZOJ 3785 What day is that day?【思维+递推循环节】
- J - What day is that day?(zoj水题)
- Unity3D自带例子AngryBots的分析
- 周杰伦澳洲过安检双节棍被扣 被质疑挟大批武器入境
- ZOJ3787 Access System
- C语言中函数参数入栈的顺序
- 利用 test 指令的測試功能
- ZOJ3785 What day is that day?(找循环节)
- LeetCode – Evaluate Reverse Polish Notation
- 幸福就是和相爱的人过一辈子
- windows adb不识别(VID PID更改)
- 每日自动签到签退的程序
- 谁能守候你一生
- seo的基本操作
- 解决ORA-00054: resource busy and acquire with NOWAIT specified需要注意
- StoryBoard下多个View的切换