Topic Link: The number of loops, at the beginning I thought to use high precision according to test instructions a number to judge, and then Baidu found the original for the "cycle number" has already been researched, first attached a few links:
Cyclic number
Artin ' s Constant
Number of Cycles
A full circle of fun and humor
According to the number of numbers in the encyclopedia has been counted a few cycles can be directly judged by the table:
1#include <cstdio>2#include <cstring>3#include <string>4#include <map>5#include <algorithm>6 using namespacestd;7 8 strings[Ten] = {9 "142857",//(6-bit)Ten "0588235294117647",//(16-bit) One "052631578947368421",//(18-bit) A "0434782608695652173913",//(22-bit) - "0344827586206896551724137931",//(28-bit) - "0212765957446808510638297872340425531914893617",//(46-bit) the "0169491525423728813559322033898305084745762711864406779661",//(58-bit) - "016393442622950819672131147540983606557377049180327868852459",//(60-bit) - }; - + intwei[Ten] = {7, -, +, at, in, -, -, A}; - + Charp[ -]; A at intMain () { -map<string,int>m; - for(inti =0; I <=7; ++i) -M[s[i]] = s[i].size () +1; - while(~SCANF ("%s", p)) -Puts (M[p]?"Yes":"No"); in return 0; -}
View Code
Number of Cycles