diff --git a/.idea/misc.xml b/.idea/misc.xml index 07115cd..6f29fee 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Divisions/Beta/Round15/MaximumIncrease.java b/Divisions/Beta/Round15/MaximumIncrease.java new file mode 100644 index 0000000..44f1f8e --- /dev/null +++ b/Divisions/Beta/Round15/MaximumIncrease.java @@ -0,0 +1,31 @@ +package Divisions.Beta.Round15; + +//code by senurah +import java.util.Scanner; + +public class MaximumIncrease { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int n = scanner.nextInt(); + int[] arr = new int[n]; + + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + + int maxLength = 1; + int currentLength = 1; + + for (int i = 1; i < n; i++) { + if (arr[i] > arr[i - 1]) { + currentLength++; + maxLength = Math.max(maxLength, currentLength); + } else { + currentLength = 1; + } + } + + System.out.println(maxLength); + scanner.close(); + } +} diff --git a/Divisions/Beta/Round32/Borze.java b/Divisions/Beta/Round32/Borze.java new file mode 100644 index 0000000..d52dffa --- /dev/null +++ b/Divisions/Beta/Round32/Borze.java @@ -0,0 +1,23 @@ +package Divisions.Beta.Round32; +//code by senurah +public class Borze { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + String s = scanner.next(); + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) == '.') { + sb.append("0"); + } else if (s.charAt(i) == '-' && s.charAt(i + 1) == '.') { + sb.append("1"); + i++; + } else if (s.charAt(i) == '-' && s.charAt(i + 1) == '-') { + sb.append("2"); + i++; + } + } + + System.out.println(sb.toString()); + } +} diff --git a/Divisions/Beta/Round4/BeforeAnExam.java b/Divisions/Beta/Round4/BeforeAnExam.java new file mode 100644 index 0000000..a8259c1 --- /dev/null +++ b/Divisions/Beta/Round4/BeforeAnExam.java @@ -0,0 +1,43 @@ +package Divisions.Beta.Round4; +//code by senurah +public class BeforeAnExam { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int d = scanner.nextInt(); + int sumTime = scanner.nextInt(); + int[] minTimes = new int[d]; + int[] maxTimes = new int[d]; + int minTotal = 0; + int maxTotal = 0; + for (int i = 0; i < d; i++) { + minTimes[i] = scanner.nextInt(); + maxTimes[i] = scanner.nextInt(); + minTotal += minTimes[i]; + maxTotal += maxTimes[i]; + } + + if (sumTime < minTotal || sumTime > maxTotal) { + System.out.println("NO"); + } else { + System.out.println("YES"); + int[] schedule = new int[d]; + + for (int i = 0; i < d; i++) { + schedule[i] = minTimes[i]; + } + + int remainingTime = sumTime - minTotal; + + for (int i = 0; i < d && remainingTime > 0; i++) { + int availableTime = maxTimes[i] - minTimes[i]; + int timeToAdd = Math.min(remainingTime, availableTime); + schedule[i] += timeToAdd; + remainingTime -= timeToAdd; + } + + for (int i = 0; i < d; i++) { + System.out.print(schedule[i] + " "); + } + } + } +} diff --git a/Divisions/Beta/Round57/UltraFastMathematician.java b/Divisions/Beta/Round57/UltraFastMathematician.java new file mode 100644 index 0000000..05e4909 --- /dev/null +++ b/Divisions/Beta/Round57/UltraFastMathematician.java @@ -0,0 +1,19 @@ +package Divisions.Beta.Round57; +//code by senurah +public class UltraFastMathematician { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + String a = scanner.next(); + String b = scanner.next(); + + if (a.length() == b.length()) { + for (int i = 0; i < a.length(); i++) { + if (a.charAt(i) == b.charAt(i)) { + System.out.print("0"); + } else { + System.out.print("1"); + } + } + } + } +} diff --git a/Divisions/Beta/Round69/PanoramixsPrediction.java b/Divisions/Beta/Round69/PanoramixsPrediction.java new file mode 100644 index 0000000..8729e5b --- /dev/null +++ b/Divisions/Beta/Round69/PanoramixsPrediction.java @@ -0,0 +1,41 @@ +package Divisions.Beta.Round69; +//code by senurah +public class PanoramixsPrediction { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int m = scanner.nextInt(); + + if (n >= 2 && n <= 50 && m >= 2 && m <= 50) { + int nextPrime = 0; + for (int i = n + 1; i <= m; i++) { + if (isPrime(i)) { + nextPrime = i; + break; + } + } + + if (nextPrime == m) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + + scanner.close(); + } + + private static boolean isPrime(int num) { + if (num <= 1) { + return false; + } + for (int i = 2; i <= Math.sqrt(num); i++) { + if (num % i == 0) { + return false; + } + } + return true; + } + + +} diff --git a/Divisions/Beta/Round8/Cplusequal.java b/Divisions/Beta/Round8/Cplusequal.java new file mode 100644 index 0000000..b7bb19f --- /dev/null +++ b/Divisions/Beta/Round8/Cplusequal.java @@ -0,0 +1,31 @@ +package Divisions.Beta.Round8; +//code by senurah +import java.util.Scanner; + +public class Cplusequal { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int T = scanner.nextInt(); + StringBuilder result = new StringBuilder(); + + for (int t = 0; t < T; t++) { + int a = scanner.nextInt(); + int b = scanner.nextInt(); + int n = scanner.nextInt(); + int count = 0; + + while (a <= n && b <= n) { + if (a < b) { + a += b; + } else { + b += a; + } + count++; + } + result.append(count).append("\n"); + } + + System.out.print(result); + } +} + diff --git a/Divisions/Beta/Round9/DieRoll.java b/Divisions/Beta/Round9/DieRoll.java new file mode 100644 index 0000000..b88cedd --- /dev/null +++ b/Divisions/Beta/Round9/DieRoll.java @@ -0,0 +1,27 @@ +package Divisions.Beta.Round9; + +import java.util.Scanner; + +//code by senurah +public class DieRoll { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + int y = scanner.nextInt(); + int w = scanner.nextInt(); + + int maxRoll = Math.max(y, w); + int favorableOutcomes = 6 - maxRoll + 1; + + switch (favorableOutcomes) { + case 1: System.out.println("1/6"); break; + case 2: System.out.println("1/3"); break; + case 3: System.out.println("1/2"); break; + case 4: System.out.println("2/3"); break; + case 5: System.out.println("5/6"); break; + case 6: System.out.println("1/1"); break; + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round105/InsomniaCure.java b/Divisions/Div2/Round105/InsomniaCure.java new file mode 100644 index 0000000..2ab7a3e --- /dev/null +++ b/Divisions/Div2/Round105/InsomniaCure.java @@ -0,0 +1,25 @@ +package Divisions.Div2.Round105; +//code by senurah +public class InsomniaCure { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int k = scanner.nextInt(); + int l = scanner.nextInt(); + int m = scanner.nextInt(); + int n = scanner.nextInt(); + int d = scanner.nextInt(); + + int count = 0; + if(k>=1 && k<=10 && l>=1 && l<=10 && m>=1 && m<=10 && n>=1 && n<=10 && d>=1 && d<=100000){ + for (int i = 1; i <= d; i++) { + if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) { + count++; + } + } + + System.out.println(count); + + } + + } +} diff --git a/Divisions/Div2/Round107/SoftDrinking.java b/Divisions/Div2/Round107/SoftDrinking.java new file mode 100644 index 0000000..f6de669 --- /dev/null +++ b/Divisions/Div2/Round107/SoftDrinking.java @@ -0,0 +1,22 @@ +package Divisions.Div2.Round107; +//code by senurah +public class SoftDrinking { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int k = scanner.nextInt(); + int l = scanner.nextInt(); + int c = scanner.nextInt(); + int d = scanner.nextInt(); + int p = scanner.nextInt(); + int nl = scanner.nextInt(); + int np = scanner.nextInt(); + + int totalDrink = k * l; + int totalLime = c * d; + int totalSalt = p; + + int totalToast = Math.min(totalDrink / nl, Math.min(totalLime, totalSalt / np)) / n; + System.out.println(totalToast); + } +} diff --git a/Divisions/Div2/Round109/I_love_username.java b/Divisions/Div2/Round109/I_love_username.java new file mode 100644 index 0000000..4b7b93e --- /dev/null +++ b/Divisions/Div2/Round109/I_love_username.java @@ -0,0 +1,27 @@ +package Divisions.Div2.Round109; +//code by senurah +public class I_love_username { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + + int max = arr[0]; + int min = arr[0]; + int count = 0; + for (int i = 1; i < n; i++) { + if (arr[i] > max) { + max = arr[i]; + count++; + } else if (arr[i] < min) { + min = arr[i]; + count++; + } + } + + System.out.println(count); + } +} diff --git a/Divisions/Div2/Round126/Drinks.java b/Divisions/Div2/Round126/Drinks.java new file mode 100644 index 0000000..94de4b3 --- /dev/null +++ b/Divisions/Div2/Round126/Drinks.java @@ -0,0 +1,19 @@ +package Divisions.Div2.Round126; +//code by senurah +public class Drinks { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + if(n>=1 && n<=100){ + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + double sum = 0; + for (int i = 0; i < n; i++) { + sum += arr[i]; + } + System.out.println(sum/n); + } + } +} diff --git a/Divisions/Div2/Round141/Isyourhorseshoeontheotherhoof.java b/Divisions/Div2/Round141/Isyourhorseshoeontheotherhoof.java new file mode 100644 index 0000000..a8824b6 --- /dev/null +++ b/Divisions/Div2/Round141/Isyourhorseshoeontheotherhoof.java @@ -0,0 +1,24 @@ +package Divisions.Div2.Round141; +//code by senurah +public class Isyourhorseshoeontheotherhoof { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int[] arr = new int[4]; + for (int i = 0; i < 4; i++) { + arr[i] = scanner.nextInt(); + } + + int count = 0; + for (int i = 0; i < 4; i++) { + for (int j = i + 1; j < 4; j++) { + if (arr[i] == arr[j]) { + count++; + break; + } + } + } + + System.out.println(count); + + } +} diff --git a/Divisions/Div2/Round163/QueueAtTheSchool.java b/Divisions/Div2/Round163/QueueAtTheSchool.java new file mode 100644 index 0000000..f076a8a --- /dev/null +++ b/Divisions/Div2/Round163/QueueAtTheSchool.java @@ -0,0 +1,24 @@ +package Divisions.Div2.Round163; +//code by senurah +public class QueueAtTheSchool { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int t = scanner.nextInt(); + scanner.nextLine(); + if(n>=1 && n<=50 && t>=1 && t<=50){ + String s = scanner.nextLine(); + char[] arr = s.toCharArray(); + for (int i = 0; i < t; i++) { + for (int j = 0; j < n - 1; j++) { + if (arr[j] == 'B' && arr[j + 1] == 'G') { + arr[j] = 'G'; + arr[j + 1] = 'B'; + j++; + } + } + } + System.out.println(new String(arr)); + } + } +} diff --git a/Divisions/Div2/Round164/Games.java b/Divisions/Div2/Round164/Games.java new file mode 100644 index 0000000..dc5c8d7 --- /dev/null +++ b/Divisions/Div2/Round164/Games.java @@ -0,0 +1,32 @@ +package Divisions.Div2.Round164; +//code by senurah +import java.util.Scanner; + +public class Games { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int n = sc.nextInt(); + int[] homeUniform = new int[n]; + int[] guestUniform = new int[n]; + + for (int i = 0; i < n; i++) { + homeUniform[i] = sc.nextInt(); + guestUniform[i] = sc.nextInt(); + } + + int count = 0; + + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { + if (i != j && homeUniform[i] == guestUniform[j]) { + count++; + } + } + } + + System.out.println(count); + + sc.close(); + } +} diff --git a/Divisions/Div2/Round223/SerejaandDima.java b/Divisions/Div2/Round223/SerejaandDima.java new file mode 100644 index 0000000..efc933a --- /dev/null +++ b/Divisions/Div2/Round223/SerejaandDima.java @@ -0,0 +1,45 @@ +package Divisions.Div2.Round223; +//code by senurah +public class SerejaandDima { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + + if (n >= 1 && n <= 1000) { + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + + int sereja = 0; + int dima = 0; + int i = 0; + int j = n - 1; + boolean isSereja = true; + while (i <= j) { + if (isSereja) { + if (arr[i] > arr[j]) { + sereja += arr[i]; + i++; + } else { + sereja += arr[j]; + j--; + } + } else { + if (arr[i] > arr[j]) { + dima += arr[i]; + i++; + } else { + dima += arr[j]; + j--; + } + } + isSereja = !isSereja; + } + + System.out.println(sereja + " " + dima); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round244/PoliceRecruits.java b/Divisions/Div2/Round244/PoliceRecruits.java new file mode 100644 index 0000000..cdf161b --- /dev/null +++ b/Divisions/Div2/Round244/PoliceRecruits.java @@ -0,0 +1,30 @@ +package Divisions.Div2.Round244; +//code by senurah +public class PoliceRecruits { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + + if (n >= 1 && n <= 1000) { + int count = 0; + int officers = 0; + for (int i = 0; i < n; i++) { + int event = scanner.nextInt(); + + if (event == -1) { + if (officers == 0) { + count++; + } else { + officers--; + } + } else { + officers += event; + } + } + + System.out.println(count); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round246/ChoosingTeams.java b/Divisions/Div2/Round246/ChoosingTeams.java new file mode 100644 index 0000000..d4d4ae8 --- /dev/null +++ b/Divisions/Div2/Round246/ChoosingTeams.java @@ -0,0 +1,23 @@ +package Divisions.Div2.Round246; +//code by senurah +public class ChoosingTeams { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int k = scanner.nextInt(); + + if (n >= 1 && n <= 2000 && k >= 1 && k <= 5) { + int count = 0; + for (int i = 0; i < n; i++) { + int time = scanner.nextInt(); + if (time <= 5 - k) { + count++; + } + } + + System.out.println(count / 3); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round253/AntonandLetters.java b/Divisions/Div2/Round253/AntonandLetters.java new file mode 100644 index 0000000..5623f16 --- /dev/null +++ b/Divisions/Div2/Round253/AntonandLetters.java @@ -0,0 +1,20 @@ +package Divisions.Div2.Round253; +//code by senurah +public class AntonandLetters { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + String line = scanner.nextLine(); + line = line.substring(1, line.length() -1); + + String[] arr = line.split(", "); + java.util.HashSet set = new java.util.HashSet<>(); + for (String c : arr) { + set.add(c); + } + if(set.contains("")){ + System.out.println(0); + }else{ + System.out.println(set.size()); + } + } +} diff --git a/Divisions/Div2/Round267/GeorgeAndAccommodation.java b/Divisions/Div2/Round267/GeorgeAndAccommodation.java new file mode 100644 index 0000000..b53fd84 --- /dev/null +++ b/Divisions/Div2/Round267/GeorgeAndAccommodation.java @@ -0,0 +1,24 @@ +package Divisions.Div2.Round267; +//code by senurah +public class GeorgeAndAccommodation { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + + if (n >= 1 && n <= 100) { + int count = 0; + for (int i = 0; i < n; i++) { + int p = scanner.nextInt(); + int q = scanner.nextInt(); + + if (q - p >= 2) { + count++; + } + } + + System.out.println(count); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round268/IWannaBetheGuy.java b/Divisions/Div2/Round268/IWannaBetheGuy.java new file mode 100644 index 0000000..a8913bd --- /dev/null +++ b/Divisions/Div2/Round268/IWannaBetheGuy.java @@ -0,0 +1,42 @@ +package Divisions.Div2.Round268; +//code by senurah +public class IWannaBetheGuy { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int p = scanner.nextInt(); + int[] x = new int[p]; + for (int i = 0; i < p; i++) { + x[i] = scanner.nextInt(); + } + int q = scanner.nextInt(); + int[] y = new int[q]; + for (int i = 0; i < q; i++) { + y[i] = scanner.nextInt(); + } + + boolean[] levels = new boolean[n]; + for (int i = 0; i < p; i++) { + levels[x[i] - 1] = true; + } + for (int i = 0; i < q; i++) { + levels[y[i] - 1] = true; + } + + boolean canPass = true; + for (int i = 0; i < n; i++) { + if (!levels[i]) { + canPass = false; + break; + } + } + + if (canPass) { + System.out.println("I become the guy."); + } else { + System.out.println("Oh, my keyboard!"); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round270/LearnFromMath.java b/Divisions/Div2/Round270/LearnFromMath.java new file mode 100644 index 0000000..b10456f --- /dev/null +++ b/Divisions/Div2/Round270/LearnFromMath.java @@ -0,0 +1,31 @@ +package Divisions.Div2.Round270; +//code by senurah +public class LearnFromMath { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + + if (n >= 12 && n <= 1000000) { + for (int i = 4; i <= n / 2; i++) { + int j = n - i; + if (isComposite(i) && isComposite(j)) { + System.out.println(i + " " + j); + break; + } + } + } + scanner.close(); + } + + private static boolean isComposite(int num) { + if (num <= 1) { + return false; + } + for (int i = 2; i <= Math.sqrt(num); i++) { + if (num % i == 0) { + return true; + } + } + return false; + } +} diff --git a/Divisions/Div2/Round280/VanyaAndCubes.java b/Divisions/Div2/Round280/VanyaAndCubes.java new file mode 100644 index 0000000..d2ee49c --- /dev/null +++ b/Divisions/Div2/Round280/VanyaAndCubes.java @@ -0,0 +1,20 @@ +package Divisions.Div2.Round280; +//code by senurah +public class VanyaAndCubes { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int height = 0; + int sum = 0; + int i = 1; + while (sum <= n) { + sum += i * (i + 1) / 2; + if (sum <= n) { + height++; + } + i++; + } + System.out.println(height); + scanner.close(); + } +} diff --git a/Divisions/Div2/Round290/FoxAndSnake.java b/Divisions/Div2/Round290/FoxAndSnake.java new file mode 100644 index 0000000..bcc2a49 --- /dev/null +++ b/Divisions/Div2/Round290/FoxAndSnake.java @@ -0,0 +1,32 @@ +package Divisions.Div2.Round290; +//code by senurah +public class FoxAndSnake { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int m = scanner.nextInt(); + + if (n >= 1 && n <= 50 && m >= 1 && m <= 50) { + for (int i = 0; i < n; i++) { + if (i % 2 == 0) { + for (int j = 0; j < m; j++) { + System.out.print("#"); + } + } else { + if (i % 4 == 1) { + for (int j = 0; j < m - 1; j++) { + System.out.print("."); + } + System.out.print("#"); + } else { + System.out.print("#"); + for (int j = 0; j < m - 1; j++) { + System.out.print("."); + } + } + } + System.out.println(); + } + } + } +} diff --git a/Divisions/Div2/Round322/VasyatheHipster.java b/Divisions/Div2/Round322/VasyatheHipster.java new file mode 100644 index 0000000..2e48e28 --- /dev/null +++ b/Divisions/Div2/Round322/VasyatheHipster.java @@ -0,0 +1,14 @@ +package Divisions.Div2.Round322; +//code by senurah +public class VasyatheHipster { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int a = scanner.nextInt(); + int b = scanner.nextInt(); + + int min = Math.min(a, b); + int max = Math.max(a, b); + + System.out.println(min + " " + (max - min) / 2); + } +} diff --git a/Divisions/Div2/Round365/MishkaAndGame.java b/Divisions/Div2/Round365/MishkaAndGame.java new file mode 100644 index 0000000..b41c572 --- /dev/null +++ b/Divisions/Div2/Round365/MishkaAndGame.java @@ -0,0 +1,33 @@ +package Divisions.Div2.Round365; +//code by senurah +public class MishkaAndGame { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + + if (n >= 1 && n <= 1000) { + int mishka = 0; + int chris = 0; + for (int i = 0; i < n; i++) { + int m = scanner.nextInt(); + int c = scanner.nextInt(); + + if (m > c) { + mishka++; + } else if (c > m) { + chris++; + } + } + + if (mishka > chris) { + System.out.println("Mishka"); + } else if (chris > mishka) { + System.out.println("Chris"); + } else { + System.out.println("Friendship is magic!^^"); + } + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round368/BrainsPhotos.java b/Divisions/Div2/Round368/BrainsPhotos.java new file mode 100644 index 0000000..e14fcaa --- /dev/null +++ b/Divisions/Div2/Round368/BrainsPhotos.java @@ -0,0 +1,23 @@ +package Divisions.Div2.Round368; + +//code by senurah +import java.util.Scanner; +public class BrainsPhotos { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int n = scanner.nextInt(); + int m = scanner.nextInt(); + boolean isColor = false; + scanner.nextLine(); + + for (int i = 0; i < n; i++) { + String row = scanner.nextLine(); + if (row.contains("C") || row.contains("M") || row.contains("Y")) { + isColor = true; + break; + } + } + + System.out.println(isColor ? "#Color" : "#Black&White"); + } +} diff --git a/Divisions/Div2/Round375/TheNewYearMeetingFriends.java b/Divisions/Div2/Round375/TheNewYearMeetingFriends.java new file mode 100644 index 0000000..7d7cb7e --- /dev/null +++ b/Divisions/Div2/Round375/TheNewYearMeetingFriends.java @@ -0,0 +1,14 @@ +package Divisions.Div2.Round375; +//code by senurah +public class TheNewYearMeetingFriends { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int[] ox = new int[3]; + for (int i = 0; i < ox.length; i++) { + ox[i] = scanner.nextInt(); + } + + java.util.Arrays.sort(ox); + System.out.println(ox[2] - ox[0]); + } +} diff --git a/Divisions/Div2/Round377/BuyaShovel.java b/Divisions/Div2/Round377/BuyaShovel.java new file mode 100644 index 0000000..2788a5c --- /dev/null +++ b/Divisions/Div2/Round377/BuyaShovel.java @@ -0,0 +1,18 @@ +package Divisions.Div2.Round377; +//code by senurah +public class BuyaShovel { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int k = scanner.nextInt(); + int r = scanner.nextInt(); + + int count = 1; + while (true) { + if ((k * count) % 10 == 0 || (k * count) % 10 == r) { + System.out.println(count); + break; + } + count++; + } + } +} diff --git a/Divisions/Div2/Round392/HolidayOfEquality.java b/Divisions/Div2/Round392/HolidayOfEquality.java new file mode 100644 index 0000000..b52ba08 --- /dev/null +++ b/Divisions/Div2/Round392/HolidayOfEquality.java @@ -0,0 +1,23 @@ +package Divisions.Div2.Round392; +//code by senurah +public class HolidayOfEquality { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int[] citizens = new int[n]; + int max = 0; + for (int i = 0; i < n; i++) { + citizens[i] = scanner.nextInt(); + if (citizens[i] > max) { + max = citizens[i]; + } + } + + int sum = 0; + for (int i = 0; i < n; i++) { + sum += max - citizens[i]; + } + + System.out.println(sum); + } +} diff --git a/Divisions/Div2/Round404/AntonAndPolyhedrons.java b/Divisions/Div2/Round404/AntonAndPolyhedrons.java new file mode 100644 index 0000000..e9e0a51 --- /dev/null +++ b/Divisions/Div2/Round404/AntonAndPolyhedrons.java @@ -0,0 +1,28 @@ +package Divisions.Div2.Round404; +//code by senurah +public class AntonAndPolyhedrons { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + scanner.nextLine(); + if(n>=1 && n<=200000){ + int count =0; + for(int i =0;i= 1 && n <= 1000000000) { + int count = 0; + while (n > 0) { + if (n >= 100) { + n -= 100; + count++; + } else if (n >= 20) { + n -= 20; + count++; + } else if (n >= 10) { + n -= 10; + count++; + } else if (n >= 5) { + n -= 5; + count++; + } else { + n -= 1; + count++; + } + } + + System.out.println(count); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round638/PhoenixAndBalance.java b/Divisions/Div2/Round638/PhoenixAndBalance.java new file mode 100644 index 0000000..706b629 --- /dev/null +++ b/Divisions/Div2/Round638/PhoenixAndBalance.java @@ -0,0 +1,19 @@ +package Divisions.Div2.Round638; +//code by senurah +import java.util.Scanner; + +public class PhoenixAndBalance { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + while (t-- > 0) { + int n = scanner.nextInt(); + int sum1 = (int) Math.pow(2, n); + int sum2 = 0; + for (int i = 1; i < n / 2; i++) sum1 += (int) Math.pow(2, i); + for (int i = n / 2; i < n; i++) sum2 += (int) Math.pow(2, i); + System.out.println(Math.abs(sum1 - sum2)); + } + scanner.close(); + } +} diff --git a/Divisions/Div2/Round651/MaximumGCD.java b/Divisions/Div2/Round651/MaximumGCD.java new file mode 100644 index 0000000..069b604 --- /dev/null +++ b/Divisions/Div2/Round651/MaximumGCD.java @@ -0,0 +1,16 @@ +package Divisions.Div2.Round651; +//code by senurah +public class MaximumGCD { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=100){ + for(int i =0;i=1 && n<=1000000000){ + System.out.println(n/2); + } + } + } + } +} diff --git a/Divisions/Div2/Round654/MagicalSticks.java b/Divisions/Div2/Round654/MagicalSticks.java new file mode 100644 index 0000000..b813e6e --- /dev/null +++ b/Divisions/Div2/Round654/MagicalSticks.java @@ -0,0 +1,17 @@ +package Divisions.Div2.Round654; + +//code by senurah +import java.util.Scanner; + +public class MagicalSticks { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + System.out.println((n + 1) / 2); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round729/OddSet.java b/Divisions/Div2/Round729/OddSet.java new file mode 100644 index 0000000..1a434e7 --- /dev/null +++ b/Divisions/Div2/Round729/OddSet.java @@ -0,0 +1,27 @@ +package Divisions.Div2.Round729; + +//code by senurah +import java.util.Scanner; + +public class OddSet { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + int evenCount = 0, oddCount = 0; + + for (int i = 0; i < 2 * n; i++) { + int num = scanner.nextInt(); + if (num % 2 == 0) evenCount++; + else oddCount++; + } + + if (evenCount == oddCount) System.out.println("Yes"); + else System.out.println("No"); + } + + scanner.close(); + } +} diff --git a/Divisions/Div2/Round893/ButtonsGame.java b/Divisions/Div2/Round893/ButtonsGame.java new file mode 100644 index 0000000..ed4fb33 --- /dev/null +++ b/Divisions/Div2/Round893/ButtonsGame.java @@ -0,0 +1,22 @@ +package Divisions.Div2.Round893; + +import java.util.Scanner; + +public class ButtonsGame { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int t = sc.nextInt(); + StringBuilder result = new StringBuilder(); + for (int i = 0; i < t; i++) { + int a = sc.nextInt(); + int b = sc.nextInt(); + int c = sc.nextInt(); + if (a + c > b) { + result.append("First\n"); + } else { + result.append("Second\n"); + } + } + System.out.print(result); + } +} diff --git a/Divisions/Div3/Round388/BachgoldProblem.java b/Divisions/Div3/Round388/BachgoldProblem.java new file mode 100644 index 0000000..e92d1d5 --- /dev/null +++ b/Divisions/Div3/Round388/BachgoldProblem.java @@ -0,0 +1,22 @@ +package Divisions.Div3.Round388; +//code by senurah +public class BachgoldProblem { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + if(n>=1 && n<=100000){ + if(n%2==0){ + System.out.println(n/2); + for(int i=0;i 1) { + System.out.println(1); + } else { + System.out.println("-1"); + } + return; + } + + int x = arr[k - 1]; + + int count = 0; + for (int i = 0; i < n; i++) { + if (arr[i] <= x) { + count++; + } + } + + if (count == k) { + System.out.println(x); + } else { + System.out.println("-1"); + } + } +} diff --git a/Divisions/Div3/Round479/TwoGram.java b/Divisions/Div3/Round479/TwoGram.java new file mode 100644 index 0000000..28442d3 --- /dev/null +++ b/Divisions/Div3/Round479/TwoGram.java @@ -0,0 +1,34 @@ +package Divisions.Div3.Round479; +//code by senurah +public class TwoGram { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + scanner.nextLine(); + + if(n>=2 && n<=100){ + String line = scanner.nextLine(); + + int maxCount = 0; + String maxTwoGram = ""; + for (int i = 0; i < n - 1; i++) { + String twoGram = line.substring(i, i + 2); + int count = 0; + for (int j = 0; j < n - 1; j++) { + if (line.substring(j, j + 2).equals(twoGram)) { + count++; + } + } + + if (count > maxCount) { + maxCount = count; + maxTwoGram = twoGram; + } + } + + System.out.println(maxTwoGram); + + } + + } +} diff --git a/Divisions/Div3/Round552/RestoringThreeNumbers.java b/Divisions/Div3/Round552/RestoringThreeNumbers.java new file mode 100644 index 0000000..0cea4e4 --- /dev/null +++ b/Divisions/Div3/Round552/RestoringThreeNumbers.java @@ -0,0 +1,18 @@ +package Divisions.Div3.Round552; +//code by senurah +public class RestoringThreeNumbers { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int[] arr = new int[4]; + for (int i = 0; i < arr.length; i++) { + arr[i] = scanner.nextInt(); + } + + java.util.Arrays.sort(arr); + int a = arr[3] - arr[0]; + int b = arr[3] - arr[1]; + int c = arr[3] - arr[2]; + + System.out.println(a + " " + b + " " + c); + } +} diff --git a/Divisions/Div3/Round611/MinutesBeforetheNewYear.java b/Divisions/Div3/Round611/MinutesBeforetheNewYear.java new file mode 100644 index 0000000..184ebe6 --- /dev/null +++ b/Divisions/Div3/Round611/MinutesBeforetheNewYear.java @@ -0,0 +1,18 @@ +package Divisions.Div3.Round611; +//code by senurah +public class MinutesBeforetheNewYear { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1439){ + for(int i =0;i=0 && h<=23 && m>=0 && m<=59){ + int result = (23-h)*60 + (60-m); + System.out.println(result); + } + } + } + } +} diff --git a/Divisions/Div3/Round636/BalancedArray.java b/Divisions/Div3/Round636/BalancedArray.java new file mode 100644 index 0000000..84dc6d2 --- /dev/null +++ b/Divisions/Div3/Round636/BalancedArray.java @@ -0,0 +1,37 @@ +package Divisions.Div3.Round636; +//code by senurah +public class BalancedArray { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + + if (t >= 1 && t <= 1000) { + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + + if (n % 4 == 0) { + System.out.println("YES"); + + int sumEven = 0; + for (int j = 2; j <= n; j += 2) { + System.out.print(j + " "); + sumEven += j; + } + + int sumOdd = 0; + for (int j = 1; j < n - 1; j += 2) { + System.out.print(j + " "); + sumOdd += j; + } + + int lastOdd = sumEven - sumOdd; + System.out.println(lastOdd); + } else { + System.out.println("NO"); + } + } + } + scanner.close(); + } +} diff --git a/Divisions/Div3/Round642/TwoArraysAndSwaps.java b/Divisions/Div3/Round642/TwoArraysAndSwaps.java new file mode 100644 index 0000000..9f45e4b --- /dev/null +++ b/Divisions/Div3/Round642/TwoArraysAndSwaps.java @@ -0,0 +1,48 @@ +package Divisions.Div3.Round642; + +//code by senurah +import java.util.Arrays; +import java.util.Scanner; + +public class TwoArraysAndSwaps { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + int k = scanner.nextInt(); + + int[] a = new int[n]; + int[] b = new int[n]; + + for (int i = 0; i < n; i++) { + a[i] = scanner.nextInt(); + } + for (int i = 0; i < n; i++) { + b[i] = scanner.nextInt(); + } + + Arrays.sort(a); + Arrays.sort(b); + + for (int i = 0; i < k && i < n; i++) { + if (a[i] < b[n - 1 - i]) { + int temp = a[i]; + a[i] = b[n - 1 - i]; + b[n - 1 - i] = temp; + } else { + break; + } + } + + int sum = 0; + for (int num : a) { + sum += num; + } + System.out.println(sum); + } + + scanner.close(); + } +} diff --git a/Divisions/Div3/Round644/HonestCoach.java b/Divisions/Div3/Round644/HonestCoach.java new file mode 100644 index 0000000..a12a297 --- /dev/null +++ b/Divisions/Div3/Round644/HonestCoach.java @@ -0,0 +1,32 @@ +package Divisions.Div3.Round644; + +//code by senurah +import java.util.Arrays; +import java.util.Scanner; + +public class HonestCoach { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + int[] strengths = new int[n]; + + for (int i = 0; i < n; i++) { + strengths[i] = scanner.nextInt(); + } + + Arrays.sort(strengths); + int minDifference = Integer.MAX_VALUE; + + for (int i = 1; i < n; i++) { + minDifference = Math.min(minDifference, strengths[i] - strengths[i - 1]); + } + + System.out.println(minDifference); + } + + scanner.close(); + } +} diff --git a/Divisions/Div3/Round644/MinimalSquare.java b/Divisions/Div3/Round644/MinimalSquare.java new file mode 100644 index 0000000..875dd57 --- /dev/null +++ b/Divisions/Div3/Round644/MinimalSquare.java @@ -0,0 +1,20 @@ +package Divisions.Div3.Round644; +//code by senurah +public class MinimalSquare { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=10000){ + for(int i =0;i=1 && a<=100 && b>=1 && b<=100){ + int min = Math.min(a, b); + int max = Math.max(a, b); + int result = Math.max(min*2, max)*Math.max(min*2, max); + System.out.println(result); + } + } + } + } +} diff --git a/Divisions/Div3/Round650/EvenArray.java b/Divisions/Div3/Round650/EvenArray.java new file mode 100644 index 0000000..2d130cd --- /dev/null +++ b/Divisions/Div3/Round650/EvenArray.java @@ -0,0 +1,32 @@ +package Divisions.Div3.Round650; +//code by senurah +public class EvenArray { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1000){ + for(int i =0;i=1 && n<=100){ + int[] arr = new int[n]; + int even = 0; + int odd = 0; + for(int j = 0; j < n; j++) { + arr[j] = scanner.nextInt(); + if(j%2 == 0 && arr[j]%2 != 0){ + even++; + }else if(j%2 != 0 && arr[j]%2 == 0){ + odd++; + } + } + if(even == odd){ + System.out.println(even); + }else{ + System.out.println(-1); + } + } + } + } + + } +} diff --git a/Divisions/Div3/Round650/ShortSubstrings.java b/Divisions/Div3/Round650/ShortSubstrings.java new file mode 100644 index 0000000..6db7e78 --- /dev/null +++ b/Divisions/Div3/Round650/ShortSubstrings.java @@ -0,0 +1,22 @@ +package Divisions.Div3.Round650; +//code by senurah +public class ShortSubstrings { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + if(t>=1 && t<=1000){ + for (int i = 0; i < t; i++) { + String s = scanner.nextLine(); + StringBuilder sb = new StringBuilder(); + sb.append(s.charAt(0)); + for (int j = 1; j < s.length() - 1; j += 2) { + sb.append(s.charAt(j)); + } + sb.append(s.charAt(s.length() - 1)); + System.out.println(sb.toString()); + } + } + + } +} diff --git a/Divisions/Div3/Round653/RequiredRemainder.java b/Divisions/Div3/Round653/RequiredRemainder.java new file mode 100644 index 0000000..5c64f5b --- /dev/null +++ b/Divisions/Div3/Round653/RequiredRemainder.java @@ -0,0 +1,24 @@ +package Divisions.Div3.Round653; +//code by senurah +public class RequiredRemainder { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if (t >= 1 && t <= 50000) { + for (int i = 0; i < t; i++) { + int x = scanner.nextInt(); + int y = scanner.nextInt(); + int n = scanner.nextInt(); + + if (x >= 2 && y >= 0 && y < x && n >= y && n <= 1000000000) { + int maxK = n - (n % x) + y; + if (maxK > n) { + maxK -= x; + } + System.out.println(maxK); + } + } + } + scanner.close(); + } +} diff --git a/Divisions/Div3/Round661/GiftsFixing.java b/Divisions/Div3/Round661/GiftsFixing.java new file mode 100644 index 0000000..e4d4bca --- /dev/null +++ b/Divisions/Div3/Round661/GiftsFixing.java @@ -0,0 +1,33 @@ +package Divisions.Div3.Round661; +//code by senurah +import java.util.Scanner; + +public class GiftsFixing { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int t = sc.nextInt(); + while (t-- > 0) { + int n = sc.nextInt(); + int[] a = new int[n]; + int[] b = new int[n]; + int minA = Integer.MAX_VALUE, minB = Integer.MAX_VALUE; + for (int i = 0; i < n; i++) { + a[i] = sc.nextInt(); + if (a[i] < minA) minA = a[i]; + } + for (int i = 0; i < n; i++) { + b[i] = sc.nextInt(); + if (b[i] < minB) minB = b[i]; + } + long moves = 0; + for (int i = 0; i < n; i++) { + int da = a[i] - minA; + int db = b[i] - minB; + moves += Math.max(da, db); + } + System.out.println(moves); + } + sc.close(); + } +} + diff --git a/Divisions/Div3/Round667/YetAnotherTwoIntegersProblem.java b/Divisions/Div3/Round667/YetAnotherTwoIntegersProblem.java new file mode 100644 index 0000000..0af494d --- /dev/null +++ b/Divisions/Div3/Round667/YetAnotherTwoIntegersProblem.java @@ -0,0 +1,21 @@ +package Divisions.Div3.Round667; +//code by senurah +public class YetAnotherTwoIntegersProblem { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + for (int i = 0; i < t; i++) { + int a = scanner.nextInt(); + int b = scanner.nextInt(); + + int diff = Math.abs(a - b); + int count = diff / 10; + if (diff % 10 != 0) { + count++; + } + + System.out.println(count); + } + } +} diff --git a/Divisions/Div3/Round674/FloorNumber.java b/Divisions/Div3/Round674/FloorNumber.java new file mode 100644 index 0000000..5485cb6 --- /dev/null +++ b/Divisions/Div3/Round674/FloorNumber.java @@ -0,0 +1,21 @@ +package Divisions.Div3.Round674; +//code by senurah +import java.util.Scanner; + +public class FloorNumber { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + while (t-- > 0) { + int n = scanner.nextInt(); + int x = scanner.nextInt(); + if (n <= 2) { + System.out.println(1); + } else { + int floor = (int) Math.ceil((double) (n - 2) / x) + 1; + System.out.println(floor); + } + } + scanner.close(); + } +} \ No newline at end of file diff --git a/Divisions/Div3/Round677/BoringApartments.java b/Divisions/Div3/Round677/BoringApartments.java new file mode 100644 index 0000000..3deb8b3 --- /dev/null +++ b/Divisions/Div3/Round677/BoringApartments.java @@ -0,0 +1,18 @@ +package Divisions.Div3.Round677; +//code by senurah +public class BoringApartments { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int x = scanner.nextInt(); + int digit = x % 10; + int length = String.valueOf(x).length(); + int ans = (digit - 1) * 10 + (length * (length + 1)) / 2; + System.out.println(ans); + } + + scanner.close(); + } +} \ No newline at end of file diff --git a/Divisions/Div3/Round693/FairDivision.java b/Divisions/Div3/Round693/FairDivision.java new file mode 100644 index 0000000..b88216b --- /dev/null +++ b/Divisions/Div3/Round693/FairDivision.java @@ -0,0 +1,43 @@ +package Divisions.Div3.Round693; +//code by senurah +public class FairDivision { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if (t >= 1 && t <= 10000) { + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + if (n >= 1 && n <= 100) { + int sum1 = 0; + int sum2 = 0; + for (int j = 0; j < n; j++) { + int x = scanner.nextInt(); + if (x == 1) { + sum1++; + } else { + sum2++; + } + } + + int totalWeight = sum1 + 2 * sum2; + if (totalWeight % 2 == 0) { + int halfWeight = totalWeight / 2; + if (halfWeight % 2 == 0 || (halfWeight % 2 == 1 && sum1 > 0)) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } else { + System.out.println("NO"); + } + } + } + } + scanner.close(); + } +} + + + + + diff --git a/Divisions/Div3/Round713/SpyDetected.java b/Divisions/Div3/Round713/SpyDetected.java new file mode 100644 index 0000000..922eb0a --- /dev/null +++ b/Divisions/Div3/Round713/SpyDetected.java @@ -0,0 +1,36 @@ +package Divisions.Div3.Round713; +//code by senurah +public class SpyDetected { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int j = 0; j < n; j++) { + arr[j] = scanner.nextInt(); + } + + int[] count = new int[101]; + for (int j = 0; j < n; j++) { + count[arr[j]]++; + } + + int spy = 0; + for (int j = 0; j < 101; j++) { + if (count[j] == 1) { + spy = j; + break; + } + } + + for (int j = 0; j < n; j++) { + if (arr[j] == spy) { + System.out.println(j + 1); + break; + } + } + } + } +} diff --git a/Divisions/Div3/Round719/DoNotBeDistracted.java b/Divisions/Div3/Round719/DoNotBeDistracted.java new file mode 100644 index 0000000..9dabdca --- /dev/null +++ b/Divisions/Div3/Round719/DoNotBeDistracted.java @@ -0,0 +1,36 @@ +package Divisions.Div3.Round719; +//code by senurah +public class DoNotBeDistracted { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1000){ + for(int i =0;i=1 && n<=100){ + String s = scanner.next(); + boolean[] visited = new boolean[26]; + boolean flag = true; + char prev = s.charAt(0); + visited[prev - 'A'] = true; + for(int j = 1; j < n; j++) { + char curr = s.charAt(j); + if(curr != prev) { + if(visited[curr - 'A']) { + flag = false; + break; + } + visited[curr - 'A'] = true; + prev = curr; + } + } + if(flag) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + } + } + } +} diff --git a/Divisions/Div3/Round734/PolycarpAndCoins.java b/Divisions/Div3/Round734/PolycarpAndCoins.java new file mode 100644 index 0000000..0c72f20 --- /dev/null +++ b/Divisions/Div3/Round734/PolycarpAndCoins.java @@ -0,0 +1,25 @@ +package Divisions.Div3.Round734; +//code by senurah +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; + +public class PolycarpAndCoins { + public static void main(String[] args) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + int t = Integer.parseInt(reader.readLine().trim()); + StringBuilder output = new StringBuilder(); + while (t-- > 0) { + int n = Integer.parseInt(reader.readLine().trim()); + int c2 = n / 3; + int c1 = n / 3; + if (n % 3 == 1) { + c1++; + } else if (n % 3 == 2) { + c2++; + } + output.append(c1).append(" ").append(c2).append("\n"); + } + System.out.print(output); + } +} diff --git a/Divisions/Div3/Round739/DislikeOfThrees.java b/Divisions/Div3/Round739/DislikeOfThrees.java new file mode 100644 index 0000000..ecc5251 --- /dev/null +++ b/Divisions/Div3/Round739/DislikeOfThrees.java @@ -0,0 +1,28 @@ +package Divisions.Div3.Round739; +//code by senurah +import java.util.ArrayList; +import java.util.Scanner; + +public class DislikeOfThrees { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + ArrayList sequence = new ArrayList<>(); + int num = 1; + + while (sequence.size() < 1000) { + if (num % 3 != 0 && num % 10 != 3) { + sequence.add(num); + } + num++; + } + + for (int i = 0; i < t; i++) { + int k = scanner.nextInt(); + System.out.println(sequence.get(k - 1)); + } + + scanner.close(); + } + +} diff --git a/Divisions/Div3/Round762/SquareString.java b/Divisions/Div3/Round762/SquareString.java new file mode 100644 index 0000000..c55106d --- /dev/null +++ b/Divisions/Div3/Round762/SquareString.java @@ -0,0 +1,22 @@ +package Divisions.Div3.Round762; + +//code by senurah +public class SquareString { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=100){ + for (int i = 0; i < t; i++) { + String s = scanner.next(); + int n = s.length(); + + if (n % 2 == 0 && s.substring(0, n / 2).equals(s.substring(n / 2))) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + } + + } +} diff --git a/Divisions/Div3/Round764/PlusOneontheSubset.java b/Divisions/Div3/Round764/PlusOneontheSubset.java new file mode 100644 index 0000000..c59c1d0 --- /dev/null +++ b/Divisions/Div3/Round764/PlusOneontheSubset.java @@ -0,0 +1,35 @@ +package Divisions.Div3.Round764; +//code by senurah +public class PlusOneontheSubset { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + if(t >= 1 && t <= 10000) { + for(int i = 0; i < t; i++) { + int n = scanner.nextInt(); + + if(n >= 1 && n <= 100) { + int[] arr = new int[n]; + for(int j = 0; j < n; j++) { + arr[j] = scanner.nextInt(); + } + int max = arr[0]; + int min = arr[0]; + for(int j = 1; j < n; j++) { + if(arr[j] > max) { + max = arr[j]; + } + if(arr[j] < min) { + min = arr[j]; + } + } + int result = max - min; + System.out.println(result); + } + } + } + + scanner.close(); + } +} \ No newline at end of file diff --git a/Divisions/Div3/Round839/AplusB.java b/Divisions/Div3/Round839/AplusB.java new file mode 100644 index 0000000..a17af76 --- /dev/null +++ b/Divisions/Div3/Round839/AplusB.java @@ -0,0 +1,18 @@ +package Divisions.Div3.Round839; +//code by senurah +public class AplusB { + public static void main(String[] args) { + java.util.Scanner sc = new java.util.Scanner(System.in); + int i = sc.nextInt(); + sc.nextLine(); + for(int j=0;j 0) { + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + + Arrays.sort(arr); + long sum = 0; + for (int i = 0; i < n; i++) { + sum += arr[i]; + } + + if (sum % 2 == 0) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + + scanner.close(); + } +} diff --git a/Divisions/Div3/Round909/GameWithIntegers.java b/Divisions/Div3/Round909/GameWithIntegers.java new file mode 100644 index 0000000..3f8e46e --- /dev/null +++ b/Divisions/Div3/Round909/GameWithIntegers.java @@ -0,0 +1,19 @@ +package Divisions.Div3.Round909; +//code by senurah +import java.util.Scanner; + +public class GameWithIntegers { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + while (t-- > 0) { + int n = scanner.nextInt(); + if (n % 3 == 0) { + System.out.println("Second"); + } else { + System.out.println("First"); + } + } + } + +} diff --git a/Divisions/Div3/Round933/RudolfAndTheTicket.java b/Divisions/Div3/Round933/RudolfAndTheTicket.java new file mode 100644 index 0000000..cae15aa --- /dev/null +++ b/Divisions/Div3/Round933/RudolfAndTheTicket.java @@ -0,0 +1,41 @@ +package Divisions.Div3.Round933; +//code by senurah +import java.util.Scanner; + +public class RudolfAndTheTicket { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int t = sc.nextInt(); + StringBuilder result = new StringBuilder(); + + while (t-- > 0) { + int n = sc.nextInt(); + int m = sc.nextInt(); + int k = sc.nextInt(); + int[] left = new int[n]; + int[] right = new int[m]; + + for (int i = 0; i < n; i++) { + left[i] = sc.nextInt(); + } + + for (int i = 0; i < m; i++) { + right[i] = sc.nextInt(); + } + + int count = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + if (left[i] + right[j] <= k) { + count++; + } + } + } + result.append(count).append("\n"); + } + + System.out.print(result); + sc.close(); + } + +} diff --git a/Divisions/Div3/Round950/ProblemGenerator.java b/Divisions/Div3/Round950/ProblemGenerator.java new file mode 100644 index 0000000..92fc148 --- /dev/null +++ b/Divisions/Div3/Round950/ProblemGenerator.java @@ -0,0 +1,40 @@ +package Divisions.Div3.Round950; +//code by senurah +import java.util.HashMap; +public class ProblemGenerator { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + + if (t >= 1 && t <= 1000) { + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + int m = scanner.nextInt(); + scanner.nextLine(); + + String line = scanner.nextLine(); + + HashMap frequencyMap = new HashMap<>(); + for (char c : line.toCharArray()) { + frequencyMap.put(c, frequencyMap.getOrDefault(c, 0) + 1); + } + + String requiredDifficulties = "ABCDEFG"; + int additionalProblemsNeeded = 0; + + for (char difficulty : requiredDifficulties.toCharArray()) { + int currentCount = frequencyMap.getOrDefault(difficulty, 0); + + if (currentCount < m) { + additionalProblemsNeeded += (m - currentCount); + } + } + + System.out.println(additionalProblemsNeeded); + } + } + + scanner.close(); + } +} diff --git a/Divisions/Div3/Round957/AngryMonk.java b/Divisions/Div3/Round957/AngryMonk.java new file mode 100644 index 0000000..d5d5b18 --- /dev/null +++ b/Divisions/Div3/Round957/AngryMonk.java @@ -0,0 +1,40 @@ +package Divisions.Div3.Round957; +//code by senurah +public class AngryMonk { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t >= 1 && t <= 10000){ + for(int i = 0; i < t; i++){ + int n = scanner.nextInt(); + int k = scanner.nextInt(); + + int[] a = new int[k]; + for(int j = 0; j < k; j++){ + a[j] = scanner.nextInt(); + } + int max = Integer.MIN_VALUE; + int maxIndex = -1; + for (int h = 0; h < k; h++) { + if (a[h] > max) { + max = a[h]; + maxIndex = h; + } + } + + int totCal = 0; + for(int b = 0; b < k; b++){ + if(b != maxIndex){ + if(a[b] != 1){ + totCal += a[b] * 2 - 1; + } else { + totCal += 1; + } + } + } + + System.out.println(totCal); + } + } + } +} diff --git a/Divisions/Div3/Round974/RobinHelps.java b/Divisions/Div3/Round974/RobinHelps.java new file mode 100644 index 0000000..5ea6ef4 --- /dev/null +++ b/Divisions/Div3/Round974/RobinHelps.java @@ -0,0 +1,41 @@ +package Divisions.Div3.Round974; +//code by senurah +public class RobinHelps { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t <= 10000){ + for(int l = 0; l < t; l++){ + int n = scanner.nextInt(); + int k = scanner.nextInt(); + if((n>=1 && n<=50) && (k>=1 && k<=100)){ + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + + int coins = 0; + int count = 0; + + for (int i = 0; i < n; i++) { + if (arr[i] >= k) { + coins += arr[i]; + } else if (arr[i] == 0 && coins > 0) { + coins--; + count++; + } + } + + System.out.println(count); + + + } + + } + + + } + + } +} + diff --git a/Divisions/Div3/Round974/RobinHoodAndMajorOak.java b/Divisions/Div3/Round974/RobinHoodAndMajorOak.java new file mode 100644 index 0000000..9e46eee --- /dev/null +++ b/Divisions/Div3/Round974/RobinHoodAndMajorOak.java @@ -0,0 +1,29 @@ +package Divisions.Div3.Round974; +//code by senurah +import java.util.Scanner; + +public class RobinHoodAndMajorOak { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + int k = scanner.nextInt(); + + int startYear = Math.max(1, n - k + 1); + + int evenCount = (n / 2) - ((startYear - 1) / 2); + int oddCount = (n - startYear + 1) - evenCount; + + if (oddCount % 2 == 0) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round640/SumOfRoundNumbers.java b/Divisions/Div4/Round640/SumOfRoundNumbers.java new file mode 100644 index 0000000..07a7551 --- /dev/null +++ b/Divisions/Div4/Round640/SumOfRoundNumbers.java @@ -0,0 +1,32 @@ +package Divisions.Div4.Round640; +//code by senurah +public class SumOfRoundNumbers { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + int count = 0; + int[] arr = new int[5]; + int j = 0; + while (n > 0) { + int rem = n % 10; + if (rem != 0) { + arr[j] = rem; + count++; + } + n = n / 10; + j++; + } + System.out.println(count); + for (int k = 0; k < 5; k++) { + if (arr[k] != 0) { + System.out.print(arr[k] * (int) Math.pow(10, k) + " "); + } + } + System.out.println(); + } + } +} + + diff --git a/Divisions/Div4/Round784/Division.java b/Divisions/Div4/Round784/Division.java new file mode 100644 index 0000000..a101826 --- /dev/null +++ b/Divisions/Div4/Round784/Division.java @@ -0,0 +1,26 @@ +package Divisions.Div4.Round784; +//code by senurah +public class Division { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + if(t>=1 && t<=10000){ + for (int i = 0; i < t; i++) { + int rating = scanner.nextInt(); + + if (rating >= 1900) { + System.out.println("Division 1"); + } else if (rating >= 1600) { + System.out.println("Division 2"); + } else if (rating >= 1400) { + System.out.println("Division 3"); + } else { + System.out.println("Division 4"); + } + } + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round784/Triple.java b/Divisions/Div4/Round784/Triple.java new file mode 100644 index 0000000..70bb49e --- /dev/null +++ b/Divisions/Div4/Round784/Triple.java @@ -0,0 +1,27 @@ +package Divisions.Div4.Round784; + +import java.util.*; +public class Triple { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int t = sc.nextInt(); + while (t-- > 0) { + int n = sc.nextInt(); + int[] a = new int[n]; + Map freq = new HashMap<>(); + for (int i = 0; i < n; i++) { + a[i] = sc.nextInt(); + freq.put(a[i], freq.getOrDefault(a[i], 0) + 1); + } + int result = -1; + for (int key : freq.keySet()) { + if (freq.get(key) >= 3) { + result = key; + break; + } + } + System.out.println(result); + } + sc.close(); + } +} diff --git a/Divisions/Div4/Round790/EqualCandies.java b/Divisions/Div4/Round790/EqualCandies.java new file mode 100644 index 0000000..a026163 --- /dev/null +++ b/Divisions/Div4/Round790/EqualCandies.java @@ -0,0 +1,34 @@ +package Divisions.Div4.Round790; + +//code by senurah +import java.util.Scanner; +public class EqualCandies { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + for (int i = 0; i < t; i++) { + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int j = 0; j < n; j++) { + arr[j] = scanner.nextInt(); + } + + int minCandies = Integer.MAX_VALUE; + for (int j = 0; j < n; j++) { + if (arr[j] < minCandies) { + minCandies = arr[j]; + } + } + + int totalCandiesEaten = 0; + for (int j = 0; j < n; j++) { + totalCandiesEaten += (arr[j] - minCandies); + } + + System.out.println(totalCandiesEaten); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round790/Lucky.java b/Divisions/Div4/Round790/Lucky.java new file mode 100644 index 0000000..352b749 --- /dev/null +++ b/Divisions/Div4/Round790/Lucky.java @@ -0,0 +1,25 @@ +package Divisions.Div4.Round790; +//code by senurah +public class Lucky { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + scanner.nextLine(); + + if (n >= 1 && n <= 1000) { + for (int i = 0; i < n; i++) { + String ticket = scanner.nextLine(); + + int sumFirstHalf = (ticket.charAt(0) - '0') + (ticket.charAt(1) - '0') + (ticket.charAt(2) - '0'); + int sumSecondHalf = (ticket.charAt(3) - '0') + (ticket.charAt(4) - '0') + (ticket.charAt(5) - '0'); + + if (sumFirstHalf == sumSecondHalf) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + + } + } +} diff --git a/Divisions/Div4/Round799/Marathon.java b/Divisions/Div4/Round799/Marathon.java new file mode 100644 index 0000000..6acc0cf --- /dev/null +++ b/Divisions/Div4/Round799/Marathon.java @@ -0,0 +1,31 @@ +package Divisions.Div4.Round799; +//code by senurah +import java.util.Scanner; + +public class Marathon { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + int t = scanner.nextInt(); + + if(t>=1 && t<=10000){ + for (int i = 0; i < t; i++) { + int a = scanner.nextInt(); + int b = scanner.nextInt(); + int c = scanner.nextInt(); + int d = scanner.nextInt(); + + int count = 0; + + if (b > a) count++; + if (c > a) count++; + if (d > a) count++; + + System.out.println(count); + } + + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round806/ICPCBalloons.java b/Divisions/Div4/Round806/ICPCBalloons.java new file mode 100644 index 0000000..5053cdf --- /dev/null +++ b/Divisions/Div4/Round806/ICPCBalloons.java @@ -0,0 +1,32 @@ +package Divisions.Div4.Round806; +//code by senurah +import java.util.Scanner; +import java.util.HashSet; + +public class ICPCBalloons { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + String s = scanner.next(); + + HashSet solved = new HashSet<>(); + int balloons = 0; + + for (char c : s.toCharArray()) { + if (solved.contains(c)) { + balloons += 1; + } else { + solved.add(c); + balloons += 2; + } + } + + System.out.println(balloons); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round806/YesorYes.java b/Divisions/Div4/Round806/YesorYes.java new file mode 100644 index 0000000..524a1b7 --- /dev/null +++ b/Divisions/Div4/Round806/YesorYes.java @@ -0,0 +1,20 @@ +package Divisions.Div4.Round806; +//code by senurah +public class YesorYes { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + if(t>=1 && t <=1000){ + for(int i =0 ; i 0) { + int n = scanner.nextInt(); + String row1 = scanner.next(); + String row2 = scanner.next(); + + boolean isIdentical = true; + for (int i = 0; i < n; i++) { + char c1 = row1.charAt(i); + char c2 = row2.charAt(i); + if ((c1 == 'R' && c2 != 'R') || (c1 != 'R' && c2 == 'R')) { + isIdentical = false; + break; + } + } + + System.out.println(isIdentical ? "YES" : "NO"); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round817/SpellCheck.java b/Divisions/Div4/Round817/SpellCheck.java new file mode 100644 index 0000000..41ef60c --- /dev/null +++ b/Divisions/Div4/Round817/SpellCheck.java @@ -0,0 +1,33 @@ +package Divisions.Div4.Round817; +//code by senurah +import java.util.Arrays; +public class SpellCheck { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + String valid = "Timur"; + char[] validChars = valid.toCharArray(); + Arrays.sort(validChars); + + if (t>=1 && t<= 1000){ + for (int i =0;i 0) { + int n = sc.nextInt(); + int[] arr = new int[n]; + Set uniqueElements = new HashSet<>(); + + boolean hasDuplicate = false; + for (int i = 0; i < n; i++) { + arr[i] = sc.nextInt(); + if (!uniqueElements.add(arr[i])) { + hasDuplicate = true; + } + } + if (hasDuplicate) { + System.out.println("NO"); + } else { + System.out.println("YES"); + } + } + + sc.close(); + + } +} diff --git a/Divisions/Div4/Round835/MediumNumber.java b/Divisions/Div4/Round835/MediumNumber.java new file mode 100644 index 0000000..c4787d4 --- /dev/null +++ b/Divisions/Div4/Round835/MediumNumber.java @@ -0,0 +1,21 @@ +package Divisions.Div4.Round835; +//code by senurah +import java.util.Arrays; + +public class MediumNumber { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=6840){ + for(int i =0 ; i=1 && t<=26){ + for(int i = 0; i 0) { + int n = scanner.nextInt(); + int[] a = new int[n]; + for (int i = 0; i < n; i++) { + a[i] = scanner.nextInt(); + } + + Arrays.sort(a); + int mihai = 0, bianca = 0; + + for (int i = n - 1; i >= 0; i--) { + if (a[i] % 2 == 0) { + mihai += a[i]; + } else { + bianca += a[i]; + } + } + + System.out.println(mihai > bianca ? "YES" : "NO"); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round871/LoveStory.java b/Divisions/Div4/Round871/LoveStory.java new file mode 100644 index 0000000..cd0ac5e --- /dev/null +++ b/Divisions/Div4/Round871/LoveStory.java @@ -0,0 +1,26 @@ +package Divisions.Div4.Round871; + +//code by senurah +public class LoveStory { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + String target = "codeforces"; + if (t>=1 && t<=1000){ + for (int i = 0; i < t; i++) { + String s = scanner.nextLine(); + int differences = 0; + for (int j = 0; j < target.length(); j++) { + if (s.charAt(j) != target.charAt(j)) { + differences++; + } + } + System.out.println(differences); + } + + } + scanner.close(); + } +} + diff --git a/Divisions/Div4/Round886/TenWordsOfWisdom.java b/Divisions/Div4/Round886/TenWordsOfWisdom.java new file mode 100644 index 0000000..cdca401 --- /dev/null +++ b/Divisions/Div4/Round886/TenWordsOfWisdom.java @@ -0,0 +1,31 @@ +package Divisions.Div4.Round886; +//code by senurah +import java.util.Scanner; + +public class TenWordsOfWisdom { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + int winnerIndex = 1; + int maxQuality = -1; + + for (int i = 1; i <= n; i++) { + int a = scanner.nextInt(); + int b = scanner.nextInt(); + + if (a <= 10 && b > maxQuality) { + maxQuality = b; + winnerIndex = i; + } + } + + System.out.println(winnerIndex); + } + + scanner.close(); + } +} + diff --git a/Divisions/Div4/Round886/ToMyCritics.java b/Divisions/Div4/Round886/ToMyCritics.java new file mode 100644 index 0000000..d5ec0a6 --- /dev/null +++ b/Divisions/Div4/Round886/ToMyCritics.java @@ -0,0 +1,22 @@ +package Divisions.Div4.Round886; +//code by senurah +public class ToMyCritics { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1000){ + for(int i =0; i=10 || a+c >= 10 || b+c >=10){ + System.out.println("YES"); + }else{ + System.out.println("NO"); + } + + } + } + } +} diff --git a/Divisions/Div4/Round898/GoodKid.java b/Divisions/Div4/Round898/GoodKid.java new file mode 100644 index 0000000..d139842 --- /dev/null +++ b/Divisions/Div4/Round898/GoodKid.java @@ -0,0 +1,32 @@ +package Divisions.Div4.Round898; + +//code by senurah +public class GoodKid { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + + while (t-- > 0) { + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + long maxProduct = 0; + for (int i = 0; i < n; i++) { + long product = 1; + for (int j = 0; j < n; j++) { + if (j == i) { + product *= (arr[j] + 1); + } else { + product *= arr[j]; + } + } + maxProduct = Math.max(maxProduct, product); + } + System.out.println(maxProduct); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round898/ShortSort.java b/Divisions/Div4/Round898/ShortSort.java new file mode 100644 index 0000000..a11a724 --- /dev/null +++ b/Divisions/Div4/Round898/ShortSort.java @@ -0,0 +1,21 @@ +package Divisions.Div4.Round898; +//code by senurah +public class ShortSort { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + if(t>=1 && t<=6) { + for (int i = 0; i < t; i++) { + String s = scanner.nextLine(); + if(s.equals("bca") ||s.equals("cab")){ + System.out.println("NO"); + } else { + System.out.println("YES"); + } + //bca - NO + //cab - NO + } + } + } +} diff --git a/Divisions/Div4/Round918/CanISquare.java b/Divisions/Div4/Round918/CanISquare.java new file mode 100644 index 0000000..cd41ddd --- /dev/null +++ b/Divisions/Div4/Round918/CanISquare.java @@ -0,0 +1,26 @@ +package Divisions.Div4.Round918; + +//code by senurah +import java.util.Scanner; + +public class CanISquare { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + while (t-- > 0) { + int n = scanner.nextInt(); + int[] a = new int[n]; + long totalSquares = 0; + for (int i = 0; i < n; i++) { + a[i] = scanner.nextInt(); + totalSquares += a[i]; + } + long side = (long) Math.sqrt(totalSquares); + if (side * side == totalSquares) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + } + } +} diff --git a/Divisions/Div4/Round918/OddOneOut.java b/Divisions/Div4/Round918/OddOneOut.java new file mode 100644 index 0000000..9925c6b --- /dev/null +++ b/Divisions/Div4/Round918/OddOneOut.java @@ -0,0 +1,23 @@ +package Divisions.Div4.Round918; +//code by senurah +public class OddOneOut { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=270){ + for(int i =0; i countB) System.out.println("A"); + else System.out.println("B"); + } + + scanner.close(); + } +} diff --git a/Divisions/Div4/Round937/ClockConversion.java b/Divisions/Div4/Round937/ClockConversion.java new file mode 100644 index 0000000..8b15941 --- /dev/null +++ b/Divisions/Div4/Round937/ClockConversion.java @@ -0,0 +1,39 @@ +package Divisions.Div4.Round937; +//code by senurah +public class ClockConversion { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1440){ + for(int i=0 ;i12){ + System.out.println(normalization(h-12,m)[0]+":"+normalization(h-12,m)[1]+" PM"); + }else{ + System.out.println(normalization(h,m)[0]+":"+normalization(h,m)[1]+" AM"); + } + } + } + } + scanner.close(); + } + + public static String [] normalization(int h,int m){ + String hour = String.valueOf(h); + String minute = String.valueOf(m); + if(h<10){ + hour = "0"+h; + } + if (m < 10) { + minute = "0" + m; + } + return new String[]{hour,minute}; + } +} diff --git a/Divisions/Div4/Round937/ShufflingSongs.java b/Divisions/Div4/Round937/ShufflingSongs.java new file mode 100644 index 0000000..f50b897 --- /dev/null +++ b/Divisions/Div4/Round937/ShufflingSongs.java @@ -0,0 +1,62 @@ +package Divisions.Div4.Round937; +//code according to the provided tutorial +import java.util.HashMap; +import java.util.Scanner; + +public class ShufflingSongs { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + + while (t-- > 0) { + int n = scanner.nextInt(); + scanner.nextLine(); + + HashMap genreMap = new HashMap<>(); + HashMap writerMap = new HashMap<>(); + int[][] songs = new int[n][2]; + + int genreCount = 0, writerCount = 0; + for (int i = 0; i < n; i++) { + String[] songDetails = scanner.nextLine().split(" "); + String genre = songDetails[0]; + String writer = songDetails[1]; + + genreMap.putIfAbsent(genre, genreCount++); + writerMap.putIfAbsent(writer, writerCount++); + + songs[i][0] = genreMap.get(genre); + songs[i][1] = writerMap.get(writer); + } + + int maxMask = 1 << n; + boolean[][] dp = new boolean[maxMask][n]; + + // Initialize the DP table + for (int i = 0; i < n; i++) { + dp[1 << i][i] = true; + } + + int maxSongs = 0; + for (int mask = 1; mask < maxMask; mask++) { + for (int last = 0; last < n; last++) { + if ((mask & (1 << last)) == 0 || !dp[mask][last]) { + continue; + } + maxSongs = Math.max(maxSongs, Integer.bitCount(mask)); + for (int next = 0; next < n; next++) { + if ((mask & (1 << next)) == 0 && + (songs[next][0] == songs[last][0] || songs[next][1] == songs[last][1])) { + dp[mask | (1 << next)][next] = true; + } + } + } + } + + // Output the number of removals needed + System.out.println(n - maxSongs); + } + scanner.close(); + } +} diff --git a/Divisions/Div4/Round937/StairPeakOrNeither.java b/Divisions/Div4/Round937/StairPeakOrNeither.java new file mode 100644 index 0000000..09e08a7 --- /dev/null +++ b/Divisions/Div4/Round937/StairPeakOrNeither.java @@ -0,0 +1,25 @@ +package Divisions.Div4.Round937; +//code by senurah +public class StairPeakOrNeither { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=1000){ + for(int i=0;ic) { + System.out.println("PEAK"); + }else{ + System.out.println("NONE"); + } + + } + } + + } +} diff --git a/Divisions/Div4/Round944/ClockNString.java b/Divisions/Div4/Round944/ClockNString.java new file mode 100644 index 0000000..c6e6961 --- /dev/null +++ b/Divisions/Div4/Round944/ClockNString.java @@ -0,0 +1,37 @@ +package Divisions.Div4.Round944; +//code by senurah +public class ClockNString { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<= 5940){ + for(int i=0;i b) { + int temp = a; + a = b; + b = temp; + } + if (c > d) { + int temp = c; + c = d; + d = temp; + } + + if ((a < c && c < b && !(a < d && d < b)) || (a < d && d < b && !(a < c && c < b)) || + (c < a && a < d && !(c < b && b < d)) || (c < b && b < d && !(c < a && a < d))) { + System.out.println("YES"); + } else { + System.out.println("NO"); + } + + + + } + } + } +} diff --git a/Divisions/Div4/Round944/DifferentString.java b/Divisions/Div4/Round944/DifferentString.java new file mode 100644 index 0000000..0ac1576 --- /dev/null +++ b/Divisions/Div4/Round944/DifferentString.java @@ -0,0 +1,49 @@ +package Divisions.Div4.Round944; +//code by senurah +import java.util.Scanner; +import java.util.Arrays; + +public class DifferentString { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + scanner.nextLine(); + + if (t >= 1 && t <= 1000) { + for (int i = 0; i < t; i++) { + String s = scanner.nextLine(); + boolean allSame = true; + + for (int j = 1; j < s.length(); j++) { + if (s.charAt(j) != s.charAt(0)) { + allSame = false; + break; + } + } + + if (allSame) { + System.out.println("NO"); + } else { + System.out.println("YES"); + char[] chars = s.toCharArray(); + Arrays.sort(chars); + + if (new String(chars).equals(s)) { + for (int j = 1; j < chars.length; j++) { + if (chars[j] != chars[0]) { + char temp = chars[0]; + chars[0] = chars[j]; + chars[j] = temp; + break; + } + } + } + + System.out.println(new String(chars)); + } + } + } + scanner.close(); + } +} + diff --git a/Divisions/Div4/Round944/MyFirstSortingProblem.java b/Divisions/Div4/Round944/MyFirstSortingProblem.java new file mode 100644 index 0000000..0d8e9e5 --- /dev/null +++ b/Divisions/Div4/Round944/MyFirstSortingProblem.java @@ -0,0 +1,20 @@ +package Divisions.Div4.Round944; +//code by senurah +public class MyFirstSortingProblem { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=100){ + for(int i =0; i=0 && t<=100){ + for(int i=0;i= 1 && t <= 100) { + for(int i = 0; i < t; i++) { + int n = scanner.nextInt(); + HashMap map = new HashMap<>(); + + for(int j = 2; j <= n; j++) { + int sum = 0; + for(int m = 1; m * j <= n; m++) { + sum += m * j; + } + map.put(j, sum); + } + + int maxKey = -1; + int maxValue = Integer.MIN_VALUE; + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() > maxValue) { + maxValue = entry.getValue(); + maxKey = entry.getKey(); + } + } + + System.out.println(maxKey); + } + } + } +} + diff --git a/Divisions/Div4/Round971/Minimize.java b/Divisions/Div4/Round971/Minimize.java new file mode 100644 index 0000000..68ba7e1 --- /dev/null +++ b/Divisions/Div4/Round971/Minimize.java @@ -0,0 +1,24 @@ +package Divisions.Div4.Round971; +//code by senurah +import java.util.ArrayList; +import java.util.Collections; +public class Minimize { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=55){ + for(int i=0;i temp = new ArrayList(); + for(int c=a;c<=b;c++){ + // (c−a)+(b−c) + int result = (c-a)+(b-c); + temp.add(result); + + } + System.out.println(Collections.min(temp)); + } + } + } +} diff --git a/Divisions/Div4/Round971/OsuMania.java b/Divisions/Div4/Round971/OsuMania.java new file mode 100644 index 0000000..c96a631 --- /dev/null +++ b/Divisions/Div4/Round971/OsuMania.java @@ -0,0 +1,40 @@ +package Divisions.Div4.Round971; +//code by senurah +public class OsuMania { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int t = scanner.nextInt(); + if(t>=1 && t<=100){ + for(int i = 0; i= 0; j--) { + System.out.print(result[j]); + if (j != 0) { + System.out.print(" "); + } + } + System.out.println(); + + } + scanner.close(); + + + } + + } + + +} + diff --git a/Divisions/Div4/Round971/TheLegendofFreyatheFrog.java b/Divisions/Div4/Round971/TheLegendofFreyatheFrog.java new file mode 100644 index 0000000..50bf941 --- /dev/null +++ b/Divisions/Div4/Round971/TheLegendofFreyatheFrog.java @@ -0,0 +1,24 @@ +package Divisions.Div4.Round971; +//code by senurah +import java.util.Scanner; +public class TheLegendofFreyatheFrog { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int t = scanner.nextInt(); + + for (int i = 0; i < t; i++) { + int x = scanner.nextInt(); + int y = scanner.nextInt(); + int k = scanner.nextInt(); + + int xJumps = (x + k - 1) / k; + int yJumps = (y + k - 1) / k; + + int totalJumps = Math.max(xJumps * 2 - 1, yJumps * 2); + + System.out.println(totalJumps); + } + + scanner.close(); + } +} diff --git a/Divisions/Goodbye2016/NewYearAndHurry.java b/Divisions/Goodbye2016/NewYearAndHurry.java new file mode 100644 index 0000000..7808097 --- /dev/null +++ b/Divisions/Goodbye2016/NewYearAndHurry.java @@ -0,0 +1,24 @@ +package Divisions.Goodbye2016; +//code by senurah +public class NewYearAndHurry { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + int k = scanner.nextInt(); + + if (n >= 1 && n <= 10 && k >= 1 && k <= 240) { + int time = 240 - k; + int count = 0; + for (int i = 1; i <= n; i++) { + time -= 5 * i; + if (time >= 0) { + count++; + } else { + break; + } + } + + System.out.println(count); + } + } +} diff --git a/Divisions/Technocup2019/InSearchOfAnEasyProblem.java b/Divisions/Technocup2019/InSearchOfAnEasyProblem.java new file mode 100644 index 0000000..e37d01c --- /dev/null +++ b/Divisions/Technocup2019/InSearchOfAnEasyProblem.java @@ -0,0 +1,30 @@ +package Divisions.Technocup2019; +//code by senurah +public class InSearchOfAnEasyProblem { + public static void main(String[] args) { + java.util.Scanner scanner = new java.util.Scanner(System.in); + int n = scanner.nextInt(); + scanner.nextLine(); + + if (n >= 1 && n <= 100) { + String line = scanner.nextLine(); + String[] difficulties = line.split(" "); + + boolean isHard = false; + for (String difficulty : difficulties) { + if (difficulty.equals("1")) { + isHard = true; + break; + } + } + + if (isHard) { + System.out.println("HARD"); + } else { + System.out.println("EASY"); + } + } + + scanner.close(); + } +} diff --git a/README.md b/README.md index aaaaad4..3e55e6b 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,20 @@ This repository contains solutions to Codeforces problems, organized by division ### Beta -| Round Number | Link to Solution | -|--------------|------------------| -| Round 4 | [Round 4](./Divisions/Beta/Round4) | +| Round Number | Link to Solution | +|--------------|--------------------------------------| +| Round 4 | [Round 4](./Divisions/Beta/Round4) | +| Round 9 | [Round 8](./Divisions/Beta/Round8) | +| Round 9 | [Round 9](./Divisions/Beta/Round9) | +| Round 15 | [Round 15](./Divisions/Beta/Round15) | | Round 19 | [Round 19](./Divisions/Beta/Round19) | +| Round 32 | [Round 32](./Divisions/Beta/Round32) | | Round 40 | [Round 40](./Divisions/Beta/Round40) | | Round 47 | [Round 47](./Divisions/Beta/Round47) | | Round 55 | [Round 55](./Divisions/Beta/Round55) | +| Round 57 | [Round 57](./Divisions/Beta/Round57) | | Round 65 | [Round 65](./Divisions/Beta/Round65) | +| Round 69 | [Round 69](./Divisions/Beta/Round69) | | Round 77 | [Round 77](./Divisions/Beta/Round77) | | Round 84 | [Round 84](./Divisions/Beta/Round84) | | Round 85 | [Round 85](./Divisions/Beta/Round85) | @@ -22,37 +28,87 @@ This repository contains solutions to Codeforces problems, organized by division ### Div2 -| Round Number | Link to Solution | -|--------------|------------------| +| Round Number | Link to Solution | +|--------------|----------------------------------------| | Round 103 | [Round 103](./Divisions/Div2/Round103) | +| Round 105 | [Round 105](./Divisions/Div2/Round105) | +| Round 107 | [Round 107](./Divisions/Div2/Round107) | +| Round 109 | [Round 109](./Divisions/Div2/Round109) | | Round 111 | [Round 111](./Divisions/Div2/Round111) | +| Round 126 | [Round 126](./Divisions/Div2/Round126) | | Round 130 | [Round 130](./Divisions/Div2/Round130) | | Round 143 | [Round 143](./Divisions/Div2/Round143) | | Round 146 | [Round 146](./Divisions/Div2/Round146) | | Round 161 | [Round 161](./Divisions/Div2/Round161) | | Round 163 | [Round 163](./Divisions/Div2/Round163) | +| Round 164 | [Round 164](./Divisions/Div2/Round164) | | Round 166 | [Round 166](./Divisions/Div2/Round166) | | Round 172 | [Round 172](./Divisions/Div2/Round172) | | Round 173 | [Round 173](./Divisions/Div2/Round173) | | Round 188 | [Round 188](./Divisions/Div2/Round188) | | Round 197 | [Round 197](./Divisions/Div2/Round197) | | Round 200 | [Round 200](./Divisions/Div2/Round200) | +| Round 223 | [Round 223](./Divisions/Div2/Round223) | +| Round 244 | [Round 244](./Divisions/Div2/Round244) | +| Round 246 | [Round 246](./Divisions/Div2/Round246) | | Round 238 | [Round 238](./Divisions/Div2/Round238) | +| Round 253 | [Round 253](./Divisions/Div2/Round253) | +| Round 267 | [Round 267](./Divisions/Div2/Round267) | +| Round 268 | [Round 268](./Divisions/Div2/Round268) | +| Round 270 | [Round 270](./Divisions/Div2/Round270) | | Round 277 | [Round 277](./Divisions/Div2/Round277) | +| Round 280 | [Round 280](./Divisions/Div2/Round280) | +| Round 290 | [Round 290](./Divisions/Div2/Round290) | | Round 295 | [Round 295](./Divisions/Div2/Round295) | | Round 304 | [Round 304](./Divisions/Div2/Round304) | +| Round 322 | [Round 322](./Divisions/Div2/Round322) | | Round 340 | [Round 340](./Divisions/Div2/Round340) | +| Round 365 | [Round 365](./Divisions/Div2/Round365) | | Round 366 | [Round 366](./Divisions/Div2/Round366) | +| Round 368 | [Round 368](./Divisions/Div2/Round368) | +| Round 375 | [Round 375](./Divisions/Div2/Round375) | +| Round 377 | [Round 377](./Divisions/Div2/Round377) | | Round 379 | [Round 379](./Divisions/Div2/Round379) | +| Round 392 | [Round 392](./Divisions/Div2/Round392) | +| Round 404 | [Round 404](./Divisions/Div2/Round404) | | Round 405 | [Round 405](./Divisions/Div2/Round405) | +| Round 465 | [Round 465](./Divisions/Div2/Round465) | +| Round 492 | [Round 492](./Divisions/Div2/Round492) | +| Round 651 | [Round 651](./Divisions/Div2/Round651) | +| Round 654 | [Round 654](./Divisions/Div2/Round654) | +| Round 638 | [Round 638](./Divisions/Div2/Round638) | +| Round 729 | [Round 729](./Divisions/Div2/Round729) | | Round 963 | [Round 963](./Divisions/Div2/Round963) | ### Div3 -| Round Number | Link to Solution | -|--------------|------------------| +| Round Number | Link to Solution | +|--------------|----------------------------------------| +| Round 388 | [Round 388](./Divisions/Div3/Round388) | | Round 479 | [Round 479](./Divisions/Div3/Round479) | +| Round 552 | [Round 552](./Divisions/Div3/Round552) | +| Round 611 | [Round 611](./Divisions/Div3/Round611) | | Round 629 | [Round 629](./Divisions/Div3/Round629) | +| Round 636 | [Round 636](./Divisions/Div3/Round636) | +| Round 642 | [Round 642](./Divisions/Div3/Round642) | +| Round 644 | [Round 644](./Divisions/Div3/Round644) | +| Round 650 | [Round 650](./Divisions/Div3/Round650) | +| Round 653 | [Round 653](./Divisions/Div3/Round653) | +| Round 661 | [Round 661](./Divisions/Div3/Round661) | +| Round 667 | [Round 667](./Divisions/Div3/Round667) | +| Round 674 | [Round 674](./Divisions/Div3/Round674) | +| Round 677 | [Round 677](./Divisions/Div3/Round677) | +| Round 693 | [Round 693](./Divisions/Div3/Round693) | +| Round 713 | [Round 713](./Divisions/Div3/Round713) | +| Round 719 | [Round 719](./Divisions/Div3/Round719) | +| Round 734 | [Round 734](./Divisions/Div3/Round734) | +| Round 739 | [Round 739](./Divisions/Div3/Round739) | +| Round 762 | [Round 762](./Divisions/Div3/Round762) | +| Round 764 | [Round 764](./Divisions/Div3/Round764) | +| Round 839 | [Round 839](./Divisions/Div3/Round839) | +| Round 891 | [Round 891](./Divisions/Div3/Round891) | +| Round 909 | [Round 909](./Divisions/Div3/Round909) | +| Round 933 | [Round 933](./Divisions/Div3/Round933) | | Round 950 | [Round 950](./Divisions/Div3/Round950) | | Round 954 | [Round 954](./Divisions/Div3/Round954) | | Round 957 | [Round 957](./Divisions/Div3/Round957) | @@ -62,10 +118,30 @@ This repository contains solutions to Codeforces problems, organized by division ### Div4 -| Round Number | Link to Solution | -|--------------|------------------| +| Round Number | Link to Solution | +|--------------|----------------------------------------| +| Round 640 | [Round 640](./Divisions/Div4/Round640) | +| Round 784 | [Round 784](./Divisions/Div4/Round784) | +| Round 790 | [Round 790](./Divisions/Div4/Round790) | +| Round 799 | [Round 799](./Divisions/Div4/Round799) | +| Round 806 | [Round 806](./Divisions/Div4/Round806) | +| Round 817 | [Round 817](./Divisions/Div4/Round817) | | Round 827 | [Round 827](./Divisions/Div4/Round827) | +| Round 835 | [Round 835](./Divisions/Div4/Round835) | +| Round 849 | [Round 849](./Divisions/Div4/Round849) | +| Round 859 | [Round 859](./Divisions/Div4/Round859) | +| Round 871 | [Round 871](./Divisions/Div4/Round871) | +| Round 886 | [Round 886](./Divisions/Div4/Round886) | +| Round 898 | [Round 898](./Divisions/Div4/Round898) | +| Round 918 | [Round 918](./Divisions/Div4/Round918) | +| Round 928 | [Round 928](./Divisions/Div4/Round928) | +| Round 937 | [Round 937](./Divisions/Div4/Round937) | +| Round 944 | [Round 944](./Divisions/Div4/Round944) | +| Round 952 | [Round 952](./Divisions/Div4/Round952) | | Round 964 | [Round 964](./Divisions/Div4/Round964) | +| Round 971 | [Round 971](./Divisions/Div4/Round971) | +| Round 974 | [Round 974](./Divisions/Div4/Round974) | + ## Other Levels @@ -93,6 +169,13 @@ This repository contains solutions to Codeforces problems, organized by division |----------|------------------| | VK Cup 2012 | [VK Cup 2012](./Divisions/VKCup2012) | +### Good bye 2016 + +| Category | Link to Solution | +|---------------|------------------------------------------| +| Good bye 2016 | [Good bye 2016](./Divisions/Goodbye2016) | + + ## Usage Click on any of the division links above to navigate to the specific rounds and view the solutions. diff --git a/out/production/CodeForces_Solutions/.idea/misc.xml b/out/production/CodeForces_Solutions/.idea/misc.xml index 07115cd..6f29fee 100644 --- a/out/production/CodeForces_Solutions/.idea/misc.xml +++ b/out/production/CodeForces_Solutions/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/out/production/CodeForces_Solutions/Problem_Difficulty b/out/production/CodeForces_Solutions/Problem_Difficulty deleted file mode 100644 index 84bb9c9..0000000 --- a/out/production/CodeForces_Solutions/Problem_Difficulty +++ /dev/null @@ -1,29 +0,0 @@ -# Difficulty Levels - -This repository organizes CodeForces problems by their difficulty levels. Each difficulty level is represented by a folder named according to the problem rating on CodeForces. - -## Structure - -- **Level800**: Problems with a difficulty rating of 800 on CodeForces. -- **Level900**: Problems with a difficulty rating of 900 on CodeForces. -- **Level1000**: Problems with a difficulty rating of 1000 on CodeForces. -- **Level1100**: Problems with a difficulty rating of 1100 on CodeForces. -- **Level1200**: Problems with a difficulty rating of 1200 on CodeForces. -- **Level1300**: Problems with a difficulty rating of 1300 on CodeForces. -- **Level1400**: Problems with a difficulty rating of 1400 on CodeForces. -- **Level1500**: Problems with a difficulty rating of 1500 on CodeForces. -- **Level1600**: Problems with a difficulty rating of 1600 on CodeForces. -- **Level1700**: Problems with a difficulty rating of 1700 on CodeForces. -- **Level1800**: Problems with a difficulty rating of 1800 on CodeForces. -- **Level1900**: Problems with a difficulty rating of 1900 on CodeForces. -- **Level2000**: Problems with a difficulty rating of 2000 on CodeForces. -- **Level2100**: Problems with a difficulty rating of 2100 on CodeForces. -- **Level2200**: Problems with a difficulty rating of 2200 on CodeForces. -- **Level2300**: Problems with a difficulty rating of 2300 on CodeForces. -- **Level2400**: Problems with a difficulty rating of 2400 on CodeForces. -- **Level2500**: Problems with a difficulty rating of 2500 on CodeForces. - -Each folder contains solutions to problems of the corresponding difficulty level, along with the problem statement and a brief explanation of the solution approach. - -Feel free to navigate through the folders and explore the solutions! - diff --git a/out/production/CodeForces_Solutions/README.md b/out/production/CodeForces_Solutions/README.md index ebabcad..6bc0e1e 100644 --- a/out/production/CodeForces_Solutions/README.md +++ b/out/production/CodeForces_Solutions/README.md @@ -1,21 +1,184 @@ -# codeforces-solutions +# Codeforces Solutions -This repository contains solutions to various coding problems from CodeForces. Each solution is implemented in a different programming language and is accompanied by the problem statement and explanation. +This repository contains solutions to Codeforces problems, organized by division, round number, and other specific levels or categories. -## Repository Structure +## Divisions -The repository is organized by problem difficulty and problem name. Each problem has its own directory containing the solution file(s) and a README file with the problem statement and a brief explanation of the approach used. +### Beta -## Contributing +| Round Number | Link to Solution | +|--------------|--------------------------------------| +| Round 4 | [Round 4](./Divisions/Beta/Round4) | +| Round 9 | [Round 9](./Divisions/Beta/Round9) | +| Round 15 | [Round 15](./Divisions/Beta/Round15) | +| Round 19 | [Round 19](./Divisions/Beta/Round19) | +| Round 32 | [Round 32](./Divisions/Beta/Round32) | +| Round 40 | [Round 40](./Divisions/Beta/Round40) | +| Round 47 | [Round 47](./Divisions/Beta/Round47) | +| Round 55 | [Round 55](./Divisions/Beta/Round55) | +| Round 57 | [Round 57](./Divisions/Beta/Round57) | +| Round 65 | [Round 65](./Divisions/Beta/Round65) | +| Round 69 | [Round 69](./Divisions/Beta/Round69) | +| Round 77 | [Round 77](./Divisions/Beta/Round77) | +| Round 84 | [Round 84](./Divisions/Beta/Round84) | +| Round 85 | [Round 85](./Divisions/Beta/Round85) | +| Round 96 | [Round 96](./Divisions/Beta/Round96) | +| Round 97 | [Round 97](./Divisions/Beta/Round97) | -If you'd like to contribute to this repository, please fork the repository, make your changes, and submit a pull request. Ensure that each new solution includes a README file with the problem statement and explanation of the solution. +### Div2 -## License +| Round Number | Link to Solution | +|--------------|----------------------------------------| +| Round 103 | [Round 103](./Divisions/Div2/Round103) | +| Round 105 | [Round 105](./Divisions/Div2/Round105) | +| Round 107 | [Round 107](./Divisions/Div2/Round107) | +| Round 109 | [Round 109](./Divisions/Div2/Round109) | +| Round 111 | [Round 111](./Divisions/Div2/Round111) | +| Round 126 | [Round 126](./Divisions/Div2/Round126) | +| Round 130 | [Round 130](./Divisions/Div2/Round130) | +| Round 143 | [Round 143](./Divisions/Div2/Round143) | +| Round 146 | [Round 146](./Divisions/Div2/Round146) | +| Round 161 | [Round 161](./Divisions/Div2/Round161) | +| Round 163 | [Round 163](./Divisions/Div2/Round163) | +| Round 164 | [Round 164](./Divisions/Div2/Round164) | +| Round 166 | [Round 166](./Divisions/Div2/Round166) | +| Round 172 | [Round 172](./Divisions/Div2/Round172) | +| Round 173 | [Round 173](./Divisions/Div2/Round173) | +| Round 188 | [Round 188](./Divisions/Div2/Round188) | +| Round 197 | [Round 197](./Divisions/Div2/Round197) | +| Round 200 | [Round 200](./Divisions/Div2/Round200) | +| Round 223 | [Round 223](./Divisions/Div2/Round223) | +| Round 244 | [Round 244](./Divisions/Div2/Round244) | +| Round 246 | [Round 246](./Divisions/Div2/Round246) | +| Round 238 | [Round 238](./Divisions/Div2/Round238) | +| Round 253 | [Round 253](./Divisions/Div2/Round253) | +| Round 267 | [Round 267](./Divisions/Div2/Round267) | +| Round 268 | [Round 268](./Divisions/Div2/Round268) | +| Round 270 | [Round 270](./Divisions/Div2/Round270) | +| Round 277 | [Round 277](./Divisions/Div2/Round277) | +| Round 280 | [Round 280](./Divisions/Div2/Round280) | +| Round 290 | [Round 290](./Divisions/Div2/Round290) | +| Round 295 | [Round 295](./Divisions/Div2/Round295) | +| Round 304 | [Round 304](./Divisions/Div2/Round304) | +| Round 322 | [Round 322](./Divisions/Div2/Round322) | +| Round 340 | [Round 340](./Divisions/Div2/Round340) | +| Round 365 | [Round 365](./Divisions/Div2/Round365) | +| Round 366 | [Round 366](./Divisions/Div2/Round366) | +| Round 368 | [Round 368](./Divisions/Div2/Round368) | +| Round 375 | [Round 375](./Divisions/Div2/Round375) | +| Round 377 | [Round 377](./Divisions/Div2/Round377) | +| Round 379 | [Round 379](./Divisions/Div2/Round379) | +| Round 392 | [Round 392](./Divisions/Div2/Round392) | +| Round 404 | [Round 404](./Divisions/Div2/Round404) | +| Round 405 | [Round 405](./Divisions/Div2/Round405) | +| Round 465 | [Round 465](./Divisions/Div2/Round465) | +| Round 492 | [Round 492](./Divisions/Div2/Round492) | +| Round 651 | [Round 651](./Divisions/Div2/Round651) | +| Round 654 | [Round 654](./Divisions/Div2/Round654) | +| Round 638 | [Round 638](./Divisions/Div2/Round638) | +| Round 729 | [Round 729](./Divisions/Div2/Round729) | +| Round 963 | [Round 963](./Divisions/Div2/Round963) | + +### Div3 + +| Round Number | Link to Solution | +|--------------|----------------------------------------| +| Round 388 | [Round 388](./Divisions/Div3/Round388) | +| Round 479 | [Round 479](./Divisions/Div3/Round479) | +| Round 552 | [Round 552](./Divisions/Div3/Round552) | +| Round 611 | [Round 611](./Divisions/Div3/Round611) | +| Round 629 | [Round 629](./Divisions/Div3/Round629) | +| Round 636 | [Round 636](./Divisions/Div3/Round636) | +| Round 642 | [Round 642](./Divisions/Div3/Round642) | +| Round 644 | [Round 644](./Divisions/Div3/Round644) | +| Round 650 | [Round 650](./Divisions/Div3/Round650) | +| Round 653 | [Round 653](./Divisions/Div3/Round653) | +| Round 661 | [Round 661](./Divisions/Div3/Round661) | +| Round 667 | [Round 667](./Divisions/Div3/Round667) | +| Round 674 | [Round 674](./Divisions/Div3/Round674) | +| Round 677 | [Round 677](./Divisions/Div3/Round677) | +| Round 693 | [Round 693](./Divisions/Div3/Round693) | +| Round 713 | [Round 713](./Divisions/Div3/Round713) | +| Round 719 | [Round 719](./Divisions/Div3/Round719) | +| Round 734 | [Round 734](./Divisions/Div3/Round734) | +| Round 739 | [Round 739](./Divisions/Div3/Round739) | +| Round 762 | [Round 762](./Divisions/Div3/Round762) | +| Round 764 | [Round 764](./Divisions/Div3/Round764) | +| Round 839 | [Round 839](./Divisions/Div3/Round839) | +| Round 891 | [Round 891](./Divisions/Div3/Round891) | +| Round 909 | [Round 909](./Divisions/Div3/Round909) | +| Round 933 | [Round 933](./Divisions/Div3/Round933) | +| Round 950 | [Round 950](./Divisions/Div3/Round950) | +| Round 954 | [Round 954](./Divisions/Div3/Round954) | +| Round 957 | [Round 957](./Divisions/Div3/Round957) | +| Round 962 | [Round 962](./Divisions/Div3/Round962) | +| Round 966 | [Round 966](./Divisions/Div3/Round966) | +| Round 970 | [Round 970](./Divisions/Div3/Round970) | + +### Div4 + +| Round Number | Link to Solution | +|--------------|----------------------------------------| +| Round 640 | [Round 640](./Divisions/Div4/Round640) | +| Round 784 | [Round 784](./Divisions/Div4/Round784) | +| Round 790 | [Round 790](./Divisions/Div4/Round790) | +| Round 799 | [Round 799](./Divisions/Div4/Round799) | +| Round 806 | [Round 806](./Divisions/Div4/Round806) | +| Round 817 | [Round 817](./Divisions/Div4/Round817) | +| Round 827 | [Round 827](./Divisions/Div4/Round827) | +| Round 835 | [Round 835](./Divisions/Div4/Round835) | +| Round 849 | [Round 849](./Divisions/Div4/Round849) | +| Round 859 | [Round 859](./Divisions/Div4/Round859) | +| Round 871 | [Round 871](./Divisions/Div4/Round871) | +| Round 886 | [Round 886](./Divisions/Div4/Round886) | +| Round 898 | [Round 898](./Divisions/Div4/Round898) | +| Round 918 | [Round 918](./Divisions/Div4/Round918) | +| Round 928 | [Round 928](./Divisions/Div4/Round928) | +| Round 937 | [Round 937](./Divisions/Div4/Round937) | +| Round 944 | [Round 944](./Divisions/Div4/Round944) | +| Round 952 | [Round 952](./Divisions/Div4/Round952) | +| Round 964 | [Round 964](./Divisions/Div4/Round964) | +| Round 971 | [Round 971](./Divisions/Div4/Round971) | +| Round 974 | [Round 974](./Divisions/Div4/Round974) | + + +## Other Levels + +### Level 900 + +| Category | Link to Solution | +|----------|------------------| +| Level 900 | [Level 900](./Divisions/Level900) | + +### Level Unrated -This repository is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information. +| Category | Link to Solution | +|----------|------------------| +| Level Unrated | [Level Unrated](./Divisions/LevelUnrated) | -## Contact +### Summer 2024 -If you have any questions or suggestions, feel free to open an issue or contact me directly. +| Category | Link to Solution | +|----------|------------------| +| Summer 2024 | [Summer 2024](./Divisions/Summer2024) | + +### VK Cup 2012 + +| Category | Link to Solution | +|----------|------------------| +| VK Cup 2012 | [VK Cup 2012](./Divisions/VKCup2012) | + +### Good bye 2016 + +| Category | Link to Solution | +|---------------|------------------------------------------| +| Good bye 2016 | [Good bye 2016](./Divisions/Goodbye2016) | + + +## Usage + +Click on any of the division links above to navigate to the specific rounds and view the solutions. + +## License -Happy Coding! +This repository is licensed under the MIT License.