Codeforces Round #305 (Div. 2), problem: (A) Mike and Fax
2015-05-28 20:30
471 查看
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char a[1000+100]; bool judge(int m,int n) { for(int i=m;i<=(m+n)/2;i++) if(a[i]!=a[m+n-i]) return 0; return 1; } int main() { int k; while(~scanf("%s",a)) { scanf("%d",&k); int len=strlen(a); if(len%k) { printf("NO\n"); continue; } int flag=0; int i; for(i=0;i<len;i+=len/k) if(judge(i,i+len/k-1)==0) { printf("NO\n"); flag=1; break; } if(!flag) printf("YES\n"); } return 0; }
相关文章推荐
- 【CF 应用开发大赛】MZCMS内容管理系统
- windows 7 玩不了CF 打开之后进入安全登录就自动关闭
- Cloud Foundry社区周报 2015/2/17
- Cloud Foundry社区周报 2015/2/27
- 使用cf_nise_installer安装CloudFoundry出现not monitored问题
- CF Round#2
- cf3月活动大全 3月活动汇总2015
- CF#277.5div2
- Codeforces Round #260 (Div. 2)
- cf_301
- cf_297
- [cf509B]Painting Pebbles
- Codeforces Round #298 (Div. 2), problem: (A) Exam
- contest: Codeforces Round #297 (Div. 2), problem: (B) Pasha and String
- contest: Codeforces Round #300, problem: (B) Quasi Binary
- contest: Codeforces Round #300, problem: (A) Cutting Banner
- contest: Codeforces Round #300, problem: (A) Cutting Banner
- Codeforces Round #295 (Div. 2), problem: (A) Pangram
- contest: Codeforces Round #301 (Div. 2), problem: (A) Combination Lock
- codeforces 545B Equidistant String