codisinmyvines

dlya denisa

Mar 20th, 2022 (edited)
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         int A, B, N;
  8.         A = scanner.nextInt();
  9.         B = scanner.nextInt();
  10.         N = scanner.nextInt();
  11.         int min = 0;
  12.         if (B % N != 0)
  13.             min++;
  14.         min += B / N;
  15.         if (A > min)
  16.             System.out.println("Yes");
  17.         else
  18.             System.out.println("No");
  19.     }
  20. }
  21.  
  22. /////
  23. import java.util.Scanner;
  24. import java.util.ArrayList;
  25.  
  26. public class Main {
  27.  
  28.     public static String strStr(String haystack, String needle) {
  29.         if (haystack == null || needle == null) return null;
  30.         int hLength = haystack.length();
  31.         int nLength = needle.length();
  32.         if (hLength < nLength) return null;
  33.         if (nLength == 0) return haystack;
  34.         for (int i = 0; i <= hLength - nLength; i++) {
  35.             if (haystack.charAt(i) == needle.charAt(0)) {
  36.                 int j = 0;
  37.                 for (; j < nLength; j++) {
  38.                     if (haystack.charAt(i + j) != needle.charAt(j)) {
  39.                         break;
  40.                     }
  41.                 }
  42.                 if (j == nLength) return haystack.substring(i);
  43.             }
  44.         }
  45.         return null;
  46.     }
  47.  
  48.     public static void main(String[] args) {
  49.         Scanner scanner = new Scanner(System.in);
  50.         ArrayList<String> list = new ArrayList<>();
  51.         list.add("abc");
  52.         list.add("acb");
  53.         list.add("bac");
  54.         list.add("bca");
  55.         list.add("cab");
  56.         list.add("cba");
  57.         for (int i = 0; i < 3; i++) {
  58.             char ch = scanner.next().charAt(0);
  59.             if (ch == '>') {
  60.                 String needle;
  61.                 if (i == 0)
  62.                     needle = "ab";
  63.                 else {
  64.                     if (i == 1)
  65.                         needle = "ac";
  66.                     else
  67.                         needle = "bc";
  68.                 }
  69.                 list.removeIf(s -> strStr(s, needle) != null);
  70.             } else {
  71.                 if (ch == '<') {
  72.                     String needle;
  73.                     if (i == 0)
  74.                         needle = "ba";
  75.                     else {
  76.                         if (i == 1)
  77.                             needle = "ca";
  78.                         else
  79.                             needle = "cb";
  80.                     }
  81.                     list.removeIf(s -> strStr(s, needle) != null);
  82.                 }
  83.             }
  84.         }
  85.         for (String s : list)
  86.             System.out.println(s);
  87.     }
  88. }
  89.  
  90. //////
  91. import java.util.Scanner;
  92.  
  93. public class Main {
  94.  
  95.     public static void main(String[] args) {
  96.         Scanner scanner = new Scanner(System.in);
  97.         long N = scanner.nextLong();
  98.         while (N % 10 == 0)
  99.             N /= 10;
  100.         int res = 0;
  101.         while (N != 0) {
  102.             if (N % 10 == 0)
  103.                 res++;
  104.             N /= 10;
  105.         }
  106.         System.out.println(res);
  107.     }
  108. }
  109.  
  110. ///
  111. import java.util.ArrayList;
  112. import java.util.Scanner;
  113.  
  114. public class Main {
  115.  
  116.     public static void main(String[] args) {
  117.         Scanner scanner = new Scanner(System.in);
  118.         ArrayList<Character> list = new ArrayList<>();
  119.         ArrayList<String> strings = new ArrayList<>();
  120.         for (char i = 'a'; i <= 'z'; i++)
  121.             list.add(i);
  122.         int N = scanner.nextInt();
  123.         int tmp = 0;
  124.         if (N % 2 != 0)
  125.             tmp++;
  126.         for (int i = 0; i < N / 2 + tmp; i++) {
  127.             String str = "";
  128.             int k = i;
  129.             while (k > 0) {
  130.                 str += list.get(k % 26);
  131.                 k--;
  132.             }
  133.             int j = 0;
  134.             while (j < N / 2 - i) {
  135.                 str += list.get(j % 26);
  136.                 j++;
  137.             }
  138.             if (N % 2 != 0)
  139.                 str += list.get(j % 26);
  140.             j--;
  141.             while (j >= 0) {
  142.                 str += list.get(j % 26);
  143.                 j--;
  144.             }
  145.             k = 1;
  146.             while (k <= i) {
  147.                 str += list.get(k % 26);
  148.                 k++;
  149.             }
  150.             strings.add(str);
  151.         }
  152.         if (N % 2 == 0) {
  153.             for (String string : strings) System.out.println(string);
  154.             for (int i = strings.size() - 1; i >= 0; i--)
  155.                 System.out.println(strings.get(i));
  156.         } else {
  157.             for (String string : strings) System.out.println(string);
  158.             for (int i = strings.size() - 2; i >= 0; i--)
  159.                 System.out.println(strings.get(i));
  160.         }
  161.     }
  162. }
Add Comment
Please, Sign In to add comment