Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
用cin超时 改成scanf后ac 内存5956k 用时2938ms 没用算法 硬想的办法 附代码#include <iostream> #include <string> #include <stdio.h> using namespace std; int main() { char str[1000005]; while(scanf("%s",str)) { string s; s=str; if(s==".") break; string c=""; for(int i=0;i<s.size();i++) { string a=""; c+=s[i]; if(s.size()%c.size()!=0) continue; int temp=s.size()/c.size(); for(int j=1;j<=temp;j++) { a+=c; } if(a==s) { cout<<temp<<endl; break; } } } return 0; } 通过的有些尴尬 赶紧去补算法知识 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator