Eddy的难题
来源:互联网 发布:windows xp qq影音下载 编辑:程序博客网 时间:2024/06/05 20:08
自己的错代码
import java.util.Scanner;public class Main {public static void main(String[] args) {// TODO Auto-generated method stub Scanner cin=new Scanner(System.in); while(cin.hasNext()) { StringBuffer str1=new StringBuffer(cin.next()); String str=cin.next(); str1.append(str1); int flo=0; for(int i=0;i<str1.length();i++) { if(str1.indexOf(str)!=-1) { flo=0; } else { flo=1; } } if(flo==0) { System.out.println("yes"); } else { System.out.println("no"); } }}}
秋月姐姐代码
import java.util.Scanner;public class Main {public static void main(String args[]){Scanner sc=new Scanner(System.in);while(sc.hasNext()){String str1=sc.next();String str2=sc.next();if(isExist(str1,str2))System.out.println("yes");else System.out.println("no");}}public static boolean isExist(String str1,String str2){boolean f=false;StringBuffer buffer=new StringBuffer(str1);int index=0;do{if(buffer.toString().contains(str2)){ f=true; break;}else{char ch=str1.charAt(index);buffer.deleteCharAt(0).append(ch);index++;}}while(index<str1.length());return f;}}
0 0
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Eddy的难题 oj
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Eddy的难题
- Java sdut acm 2271 Eddy的难题
- Java sdut adcm 2271 Eddy的难题
- Eddy's AC难题
- Eddy's AC难题
- Eddy's AC难题
- Eddy's AC难题
- Eddy的难题 Time Limit: 1000MS Memory Limit:
- QT模块简介
- Eclipse下,修改MAVEN 中央仓库地址,解决maven下载慢问题
- SpringMVC MultipartFile文件上传
- Android 线程池
- 如何让 App 在崩溃后自动重启
- Eddy的难题
- Gps开发实战——卫星数量获取
- Android scrollview嵌套问题
- Struts2标签:<s:password>回显
- 设计模式:策略模式
- Nginx简介
- node.js搭建https服务
- gulp创建一个文件基本步骤
- poj 2001 Trie树