CodeForces 548A Mike and Fax (回文)
来源:互联网 发布:ubuntu kali工具包 编辑:程序博客网 时间:2024/05/15 04:05
#include<stdio.h>#include<iostream>#include<math.h>#include<string.h>#include<iomanip>#include<stdlib.h>#include<ctype.h>#include<algorithm>#include<deque>#include<functional>#include<iterator>#include<vector>#include<list>#include<map>#include<queue>#include<set>#include<stack>#define CPY(A, B) memcpy(A, B, sizeof(A))typedef long long LL;typedef unsigned long long uLL;const int MOD = int (1e9) + 7;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f3f3f3f3f3f3fLL;const double EPS = 1e-9;const double OO = 1e20;const double PI = acos (-1.0);const int dx[] = {-1, 0, 1, 0};const int dy[] = {0, 1, 0, -1};using namespace std;const int maxn = 1010;char str[maxn];bool isPalind (int l,int r) { while (l<r) { if (str[l]!=str[r]) { return false; } ++l; --r; } return true;}int main() { while (~scanf ("%s",str) ) { int k; cin>>k;bool f=false; int len=strlen (str); if (len%k!=0) {printf ("NO\n"); break;} int l=len/k;//先把字符串分段 for (int i=0; i<len; i++) { if (i%l==0) {//判断每一段是否是回文串 if (isPalind (i,i+l-1) ) { f=true ; } else { f=false; break; } } } (f) ?printf ("YES\n") :printf ("NO\n"); } return 0;}
0 0
- CodeForces 548A Mike and Fax (回文)
- Codeforces 548 A. Mike and Fax
- 【codeforces 548A】Mike and Fax
- A. Mike and Fax
- A. Mike and Fax
- coderforce 548A. Mike and Fax
- cf#305-A. Mike and Fax-回文串水题
- Codeforces Round #305 (Div. 2) A. Mike and Fax
- Codeforces Round #305 (Div. 2), problem: (A) Mike and Fax
- Codeforces Round #305 (Div. 2)--A. Mike and Fax
- Codeforces Round #305 (Div. 2)A. Mike and Fax
- Codeforces Round #305 (Div. 2)- Mike and Fax(分段找回文串)
- Codeforces548A:Mike and Fax
- Mike and Fax
- CodeForces 548AMike and Fax
- 【CodeForces】A. Mike and Frog
- CF Mike and Fax 字符串组成
- codeforces 548 Mike and Frog
- org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map ***
- strtoul字符串转换函数
- python学习——装饰器
- 【信息安全】RSA-数字签名-数字证书
- Paint之函数大汇总
- CodeForces 548A Mike and Fax (回文)
- python 服务器日志分析
- HashSetDemo
- PHP识别电脑还是手机访问网站
- 微信、陌陌等著名IM软件设计架构详解
- storm用来做实时日志分析的浅显使用
- 统一日志管理-Mongo 篇
- 代码重构原则 by acidrain
- Java - 如何进入阻塞状态