思路
暴力打表后,发现答案序列是周期性的,周期为 。 然后 的答案与 相同, 与 相同,以此类推。由于 可能为 ,所以可知 的答案与 相同。
AC Code
#include<bits/stdc++.h>
using namespace std;
int a[15]={0,2,4,8,8,2,10,2,8,8,4,2,14};
int main(){
int c,t;
cin>>c>>t;
while(t--){
int n;
cin>>n;
cout<<a[(n-1)%12+1]<<endl;
}
return 0;
}