求S

求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]);
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章