求S
S(n)=n^5 求S(n)除以3的餘數
Input
每行輸入一個整數n,(0 < n < 1000000) 處理到文件結束
Output
輸出S(n)%3的結果並換行
Sample Input
1
2
Sample Output
1
2
#include <stdio.h>
int main(void)
{
long long n;
while(scanf("%lld", &n) == 1)
{
int ans[4] = { 0, 1, 2, 0,};
printf("%d\n", ans[n % 3]);
}
}