TheRoundCityDiv2
SRM 734 · 2018-05-16 · by Vasyl[alphacom]
Problem Statement
John and Brus now want to count all houses in the city. You are given the
Constraints
- r will be between 1 and 100, inclusive.
1 Returns: 4
There are four houses in the city: (0, 1), (0, -1), (1, 0) and (-1, 0).
2 Returns: 12
There are twelve houses in the city: (0, 1), (0, -1), (1, 0), (-1, 0), (0, 2), (0, -2), (2, 0), (-2, 0), (1, 1), (1, -1), (-1, 1) and (-1, -1).
3 Returns: 28
There are twenty-eight houses in the city: (0, 1), (0, -1), (1, 0), (-1, 0), (0, 2), (0, -2), (2, 0), (-2, 0), (1, 1), (1, -1), (-1, 1), (-1, -1), (0, 3), (0, -3), (3, 0), (-3, 0), (1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1), (2, 2), (2, -2), (-2, 2) and (-2, -2).
47 Returns: 6920
96 Returns: 28916
Submissions are judged against all 47 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class TheRoundCityDiv2 with a public method int find(int r) · 47 test cases · 2 s / 256 MB per case