Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怒了,帖一个史上最简单的打表解法。

Posted by steven7gao at 2011-11-28 23:23:33 on Problem 1047
#include<iostream>
#include<string>
#include<map>
using namespace std;
map<string, int> dic;
string sline;
void init(){
	string str[8] = {"142857","0588235294117647","052631578947368421","0434782608695652173913","0344827586206896551724137931",
		"0212765957446808510638297872340425531914893617","0169491525423728813559322033898305084745762711864406779661",
	"016393442622950819672131147540983606557377049180327868852459"};
	for(int i=0;i<8;i++)
		dic[str[i]]=1;   
}
int main(){
   init();
   while(cin>>sline){
   if(dic.count(sline)==1) cout<<sline<<" is cyclic"<<endl;
   else  cout<<sline<<" is not cyclic"<<endl;
   }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator