zoukankan      html  css  js  c++  java
  • 2271=Eddy的难题(JAVA)

     1 import java.util.Scanner;
     2 public class Main {
     3     public static void main(String[] args) {
     4         Scanner input = new Scanner(System.in);
     5         while(input.hasNext()) {
     6             String a = input.nextLine();
     7             String b = input.nextLine();
     8             /*
     9              * 可能有人对这里有疑问,为什么要判断长度,a的长度小 那肯定不包含,那是因为本题可以移位,在这里我假设两
    10              * 个字符串,a:AA,b:AAA,很明显不是亲和串,但是我 们的算法问题,导致在判断是我们会将AA扩展成AAAA,这 样判断会导致结果错误。
    11              */
    12             if(a.length()<b.length()) {
    13                 System.out.println("no");
    14             }
    15             else {
    16                 a=a+a;
    17                 if(a.indexOf(b)!=-1)System.out.println("yes");
    18                 else System.out.println("no");
    19             }
    20         }
    21     }
    22 }
  • 相关阅读:
    c++链表实现学生成绩管理系统(简易版)
    IOS动画讲解
    栈的实现
    Masonry的使用
    二叉树详解-2
    二叉树详解-1
    CoreData的使用-2
    NSPredicate 详解
    CoreData的使用-1
    IOS常用手势用法
  • 原文地址:https://www.cnblogs.com/Angfe/p/11735513.html
Copyright © 2011-2022 走看看