Home
Problems
Contests
Status
Standings
Discuss
News
rj160316赵德锋
Logout
不得不放弃、祝你元宵节快乐!
Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic Discuss
Problem Description
又到了一年一度的元宵节啦!一心想吃到汤圆的 cyk 看着 Stone 一碗又一碗地吃汤圆羡慕不已。
cyk 发现 Stone 吃汤圆是有规律的,第 n 碗内会有 8^n 个汤圆。Stone 看到 cyk 馋得不行,便决定送给他几个汤圆,其数量为自己碗里汤圆数量的个位数。
已知当前 Stone 正在吃第 n 碗,cyk 想知道自己能获得几个汤圆?
Input
多组输入,首先输入一行 T (1 <= T <= 1000),表示数据组数。
对于每组数据,输入一个整数 n (0 <= n <= 10^6)。
Output
对于每组数据,输出一行一个整数,代表答案。
Example Input
3
1
2
3
Example Output
8
4
2
Hint
n = 1 时,Stone 有 8^1 = 8 个汤圆,他会送出 8 个汤圆。
n = 2 时,Stone 有 8^2 = 64 个汤圆,他会送出 4 个汤圆。
n = 3 时,Stone 有 8^3 = 512 个汤圆,他会送出 2 个汤圆。
Author
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
if(n==0)
{
printf("1\n");
}
else
{
n=n%4;
if(n==0)
printf("6\n");
else if(n==1)printf("8\n");
else if(n==2)printf("4\n");
else if(n==3)printf("2\n");
}
}
return 0;
}