hdu 5578 Friendship of Frog(水)
2015-12-03 20:59
351 查看
题目链接:hdu 5578 Friendship of Frog
代码
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1005; const int inf = 0x3f3f3f3f; char str[maxn]; int main () { int cas; scanf("%d", &cas); for (int kcas = 1; kcas <= cas; kcas++) { scanf("%s", str); int n = strlen(str), ans = inf; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if (str[i] == str[j]) ans = min(ans, j - i); if (ans == inf) ans = -1; printf("Case #%d: %d\n", kcas, ans); } return 0; }
相关文章推荐
- 20151203--filter
- vim显示中文乱码解决方法
- eclipse使用maven,启动工程tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.Contex
- 类图
- hdu 5573 Binary Tree(构造)
- win10 uwp 装机必备应用 含源代码
- ORA-12514: TNS:listener does not currently know of service requested in connect
- static的作用
- Redirect to ssl in codeigniter
- Hadoop的特点
- 黑马程序员——Java笔记——Java开发工具Eclipse的使用
- win10 uwp 装机必备应用 含源代码
- objective-c NSMutableAttributedString
- AFNetWorking的实现分析以及简单使用
- hdu 5572 An Easy Physics Problem(几何)
- hdu 5106 hdu 5435 数位dp
- libcurl 设置Cookie
- web前台工作笔记(时间戳、js中clone的使用、js中动态填充数据注意事项、前台查错方法的学习)
- 1030. 完美数列(25)
- 领域驱动设计(一)理解分层架构