UVa 455 - Periodic Strings【字符串】
来源:互联网 发布:淘宝客服骗局 编辑:程序博客网 时间:2024/04/30 09:20
原文网址:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=396
有点坑的是格式,题目直接暴力就可以了.............
需要每两组有效数据之间有空行,别的没有,也就是最后不输出空行......
因为这个错了两次,原来即使是最古老的oj,也不可能尽善尽美啊.........
#include<stdio.h>#include<string.h>char s[105];int len;int per(int ed){for(int i=0;i<len;++i){if(s[i%ed]!=s[i])//周期的判断{return 0;}}return 1;}void slove(){len=strlen(s);int x=len;for(int i=1;i<len;++i)//暴力{if(len%i==0&&per(i))//只有在能整除的时候运行暴力判断周期{x=i;//保存...break;}}printf("%d\n",x);}int main(){int t;//freopen("shuju.txt","r",stdin);scanf("%d",&t);for(int i=0;i<t;++i){scanf("%s",s);if(i)//不知道错在了格式还是结果....... {printf("\n");//然而还是输给了格式.......}slove();}return 0;}
0 0
- UVa 455 - Periodic Strings【字符串】
- UVa 455 Periodic Strings (字符串处理)
- UVa 455 - Periodic Strings(字符串处理)
- UVa 455 Periodic Strings(周期字符串)
- UVa 455 Periodic Strings 【字符串求周期】
- UVA 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 Periodic Strings
- UVa - 455 Periodic Strings
- UVa 455 Periodic Strings
- UVa 455 - Periodic Strings
- Uva 455-periodic strings
- Uva 455-periodic strings
- UVa-455Periodic Strings
- 【Uva 455】 Periodic Strings
- UVA - 455 Periodic Strings
- dispatch_once 写出 High Big Top 的单例类
- codeforces #323 c GCD Table(map)
- 玩转Google开源C++单元测试框架Google Test系列(gtest)
- adb命令
- iOS编程------集合视图UICollectionView
- UVa 455 - Periodic Strings【字符串】
- 第二层第五题:双基回文数
- 树状数组模板
- 细说结构字节对齐
- QT5 学习之路24---Qt 绘制系统简介
- tcp要点学习-断开连接
- UVALive 7146 muliset<> 容器用法 防御塔
- 惯性导航之欧拉角与万向节死锁(三)
- Bootstrap CSS——按钮式下拉菜单