8^n%10: 8,4,2,6 9^n%10: 9,1 2. 因为最大循环长度为4,所以我们可以看到,i^i%10和i^(i+20)%10是相同的,也就是说,i^i%10的周期是20 而(1^1+……+20^20)%10=4, 所以(1^1+……+40^40)%10=8, (1^1+……+60^60)%10=2, (1^1+……+80^80)%10=6, (1^1+……+100^100)...
记f(i)=(i^i)% 10 = (10*a+b)^(10*a+b)% 10 = b ^(10*a+b) { 二项式定理 } 利用f(i)找规律: f(10*k+0)= 0; f(10*k+1)= 1。 f(10*k+2)= 4,6。{ f(2)= 4,f(12)= 6,f(22)= 4,f(32)= 6,... } f(10*k+3)= 7。3。{ 同上 } f(10*k+4)= 6; f(...
Give you a integer number N (1<=n<=2*10100). Pleasecompute S=11+22+33+…+NN Give the last digit of S to me. Input Input file consists of several Ns, each N a line. It is ended with N=0. Output For each N give a line containing only one digit, which is the lastdigit of...