您的位置:首页 > 其它

带模除法

2015-07-19 13:24 204 查看
What day is that day?

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

21
2


Sample Output

SundayThursday


Hint

A week consists of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday.

可以打表,四十个一循环。
然而我一开始没看出来有规律的,就正常做了
首先可以把每一个幂的底数都mod 7
这样就可以分成七组,
1^1,1^8,1^15.....
2^2,2^9,2^16.....
3^n,3^10,3^17......

////

这样第七组就可以省略了
第一组也都是1,
每一组都可以用等比数列来求和
求和之后会有一个表达式
然而有分母,这样我们每一次都取模的话就不会了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  小知识