JavaRush /Java Blog /Random EN /Algorithmic problems
Joysi
Level 41

Algorithmic problems

Published in the Random EN group
The strong point of JavaRush is the abundance of practice, which greatly helps to consolidate the material given in lectures. Here, 95% of the tasks are focused on the practice of writing application or server programs. It’s great to practice the materials presented in lectures (collections, generics, arrays, multithreading, etc.) or to gradually create and refactor problems with many classes and their interactions (big ones). There are algorithmic problems like a breath of fresh air (everyone probably remembers the last bonus of level 20, building a binary tree-list), but their number is not large. This is understandable, the course is devoted to applied practice, and not algorithmics (which requires much more theory of cybernetics and mathematics). For those who are somewhat similar to me in terms of sometimes getting a little distracted and practicing more mathematical skills in programming, I recommend http://codeforces.com/. Problems there can be solved (among other programming languages) in Java 7/8. A pool of problems (in addition to them, competitions are also organized) is available at http://codeforces.com/problemset. In addition to them, there are competitions, etc. 100% makes a decision in a single java file using the default package (that is, there is no package specified in the java file) and the entry point is public static void main(String[] args). I have not tried other options for submitting a solution. I will give an example of the simplest problem (http://codeforces.com/problemset/problem/1/A) with a solution (consider it as a test example), so that you can use it as a blank when solving others: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class task1A { /* Театральная площадь в столице Берляндии представляет собой прямоугольник n × m метров. По случаю очередного юбилея города, было принято решение о замощении площади квадратными гранитными плитами. Каждая плита имеет размер a × a. Какое наименьшее количество плит понадобится для замощения площади? Разрешено покрыть плитами большую поверхность, чем театральная площадь, но она должна быть покрыта обязательно. Гранитные плиты нельзя ломать or дробить, а разрешено использовать только целиком. Границы плит должны быть параллельны границам площади. Входные данные В первой строке записано три целых натуральных числа n, m и a (1 ≤ n, m, a ≤ 10^9). Выходные данные Выведите искомое количество плит. */ public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] s=reader.readLine().split(" "); long n = Long.parseLong(s[0]); long m = Long.parseLong(s[1]); long a = Long.parseLong(s[2]); reader.close(); long cntSide1 = n/a + (int) Math.signum(n%a); long cntSide2 = m/a + (int) Math.signum(m%a); System.out.print(cntSide1*cntSide2); } } After creating the program and testing it yourself, upload the file to the website, the verification will begin soon and you can watch its process. Additionally, you can view test data during the verification process and use it to correct the program if one of the tests fails. PS If the administration considers it an advertisement for a third-party resource, you can delete it. Although I personally think that additional exercise for the brain in terms of algorithms will not hurt. PSS If there are other similar resources, write in the comments (preferably in expanded ones - pros, cons and examples of solved test problems for an easy start for others).
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION