先打表,找规律 发现243个一个循环(大概)
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<string.h>
#include<set>
#include<algorithm>
#include<map>
#include<queue>
#include<cctype>
using namespace std;
int main()
{
long long n,flag,i,temp,sum=0,j,t;
int a[300];
int zz[300] = { 0, 1, 5, 4, 1, 4, 5, 5, 6, 0, 4, 6, 0, 6, 6, 0, 2, 0, 1, 6, 0, 0, 1, 5, 6, 3, 0, 6, 6, 0, 1, 4, 6, 5, 6, 6, 0, 2, 4, 5, 0, 6, 6, 0, 4, 3, 0, 3, 4, 4, 5, 6, 3, 5, 6, 5, 5, 6, 1, 6, 0, 5, 6, 6, 0, 4, 5, 2, 6, 5, 5, 6, 0, 3, 5, 4, 5, 5, 6, 1, 3, 4, 6, 5, 5, 6, 3, 2, 6, 2, 3, 3, 4, 5, 2, 4, 5, 4, 4, 5, 0, 5, 6, 4, 5, 5, 6, 3, 4, 1, 5, 4, 4, 5, 6, 2, 4, 3, 4, 4, 5, 0, 2, 3, 5, 4, 4, 5, 2, 1, 5, 1, 2, 2, 3, 4, 1, 3, 4, 3, 3, 4, 6, 4, 5, 3, 4, 4, 5, 2, 3, 0, 4, 3, 3, 4, 5, 1, 3, 2, 3, 3, 4, 6, 1, 2, 4, 3, 3, 4, 1, 0, 4, 0, 1, 1, 2, 3, 0, 2, 3, 2, 2, 3, 5, 3, 4, 2, 3, 3, 4, 1, 2, 6, 3, 2, 2, 3, 4, 0, 2, 1, 2, 2, 3, 5, 0, 1, 3, 2, 2, 3, 0, 6, 3, 6, 0, 0, 1, 2, 6, 1, 2, 1, 1, 2, 4, 2, 3, 1, 2, 2, 3, 0, 1, 5, 2, 1, 1, 2, 3, 6, 1, 0, 1, 1, 2, 4, 6, 0, 2, 1, 1, 2, 6, 5, 2, 5, 6, 6, 0, 1, 5, 0, 1, 0, 0, 1, 3, 1, 2, 0, 1, 1, 2, 6, 0, 4, 1, 0, 0, 1, 2, 5, 0, 6, 0, 0, 1, 3, 5, 6, 1,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