The problem is to find a regular problem, just start a look very Mongolian;
Then I pushed myself a bit, 1^n,2^n,3^n,4^n their single digit will change with the increase of N, wherein 2 and 3 of the cycle section is the 4;4 cycle is 2;
This will be able to launch their and MOD5 number is in the 0,0,0,4 cycle, that is, to determine whether a number can be divisible by 4, if you can output 4, otherwise output 0;
Determine whether it can be divisible by 4: only need to determine whether the number of two digits can be divisible by 4;
#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
# include<cctype>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <set>
# include<string>
#include <stack>
#define LL Long long
#define MAX 100010
#define INF Int_max
#define EPS 1e-8
using namespace std;
Char S[max];
int main () {while
(scanf ("%s", s)! = EOF) {
int len = strlen (s), a = 0;
if (len = = 1) {
a = a + s[len-1]-' 0 ';
}
else{
A = a*10 + s[len-2]-' 0 ';
A = a*10 + s[len-1]-' 0 ';
} printf ("a =%d\n", a);
If (a% 4 = = 0) printf ("%d\n", 4);
else printf ("%d\n", 0);
}
return 0;
}