Computer Science Exam Requirements and Description
1. Exam Structure
The Computer Science exam consists of two parts: solving programming problems in one of the allowed languages and a short interview (10-15 minutes) to discuss your achievements and programming knowledge. To participate, you will need a computer with the required compilers or interpreters installed, as well as properly configured development environments. Recommended languages: Python and C++. Recommended IDEs: PyCharm and VSCode.
The exam consists of several problems, each worth 100 points for a complete solution. Partial solutions receive scores proportional to the number of test cases passed. Results will be available during the exam with a slight delay, but specific test details will not be disclosed.
2. Prerequisites for Successfully Taking the Computer Science Exam
To successfully participate, you should be proficient in one of the following programming languages: C++, Python, Java, JavaScript, Rust, Kotlin, C#, PHP, Go, Ruby, PascalABC.NET. Solutions with optimal time complexity will run within the time limits for all supported languages.
Required Knowledge for Admission to the 4-Year Program:
- Ability to work with automated testing systems (e.g., Codeforces, Informatics, Codewars, Timus, HackerRank).
- Standard input and output for numbers, strings, and arrays.
- Integer operations: division, remainder, exponentiation.
- Conditional statements, including nested ones.
- Loops.
- Two-dimensional arrays.
- Working with strings and characters.
Additional Topics for Admission to the 3-Year Program:
Additional Topics for Admission to the 2-Year Program:
- Basic understanding of the two-pointer technique, binary search, and dynamic programming.
Successfully solving problems does not require knowledge of advanced data structures, specialized algorithms, advanced mathematics, or any libraries beyond the standard library of the chosen programming language.
3. Example Problems
Problem A. The Road to School.
One morning, Sergey overslept and missed his alarm. His first computer science class was about to start soon! Fortunately, he has a powerful car. For simplicity, let’s assume the car operates as follows:
- At the beginning of each second, the car has a current speed of $v$ meters per second.
- At the beginning of each second, Sergey can either keep his speed unchanged, increase it by 1 m/s, or decrease it by 1 m/s.
- Then, during that second, the car travels a distance equal to its current speed.
- This process repeats until the destination is reached.
Sergey needs to cover exactly $S$ meters to reach his school. His speed must be 0 at both the start and the end of the journey. Negative speed is not allowed (driving in reverse might get his license revoked!). Determine the minimum time Sergey needs to reach school.
Input:
The first line contains a single integer $S$ ($1 \leq S \leq 10^{18}$) — the distance from Sergey’s home to The Island School. (Note: 64-bit or arbitrary precision integers are required: int in Python, long long in C++, long in Java and C#, int64 in Pascal, etc.)
Output:
Print a single integer — the minimum time in seconds Sergey needs to reach school.
Examples:
Scoring System:
This problem consists of 25 test cases in addition to the sample cases provided. Each test is worth 4 points. Your solution’s performance on all test cases will be available immediately during the exam.
Problem B. Unbirthday.
An unbirthday is a day in the year that is "opposite" to one's birthday. However, "opposite" can be defined in different ways. One approach is to take the exact date six months later: for example, for March 1st (month 3), the opposite would be September 1st (month 9). Another approach is to add $365/2$ or $366/2$ days. Since $365/2$ is not an integer, we consider either 182 or 183 days. For example, for March 1st, this would correspond to August 30th or 31st.
A day is called unbirthday-beautiful if the same calendar date exactly six months later falls either 182 or 183 days apart. (If this date does not exist in the month six months later, the day cannot be considered beautiful.) For example, March 1st, 2025, is not a beautiful unbirthday day, but April 5th, 2025, is—since exactly 183 days later, it falls on October 5th, 2025, making it a perfectly symmetrical date!
Determine how many unbirthday-beautiful days exist in a given year (don’t forget to consider leap years!).
Input:
The first line contains a single integer $y$ — the year number ($2001 \leq y \leq 2099$).
Output:
Print a single integer — the number of unbirthday-beautiful days in this year.
Examples:
Problem C. Chess Rooks
A chessboard of size \(N \times N\) contains \(K\) rooks. You need to determine how many pairs of rooks can attack each other.
The first line contains a natural number \(N\) (\(1 \leq N \leq 10^9\)) — the size of the board. The second line contains the number \(K\) (\(0 \leq K \leq \min(10^5, N^2)\)) — the number of rooks. The next \(K\) lines contain pairs of integers from \(1\) to \(N\) representing the coordinates of the rooks. It is guaranteed that no two rooks occupy the same square.
Recall that in chess, a rook can attack another piece if they are positioned in the same row or column, provided that no other pieces are blocking the path between them.
The program should output a single integer — the number of pairs of rooks that can attack each other.
Input:
The first line contains a single integer \(N\) — the size of the board. The second line contains an integer \(K\) — the number of rooks. The next \(K\) lines contain pairs of integers representing the coordinates of the rooks.
Output:
Print a single integer — the number of pairs of rooks that can attack each other.
Examples:
5
7
1 2
2 1
2 3
2 5
1 4
3 4
3 2
6
Examples of Reading and Writing Data
Problem 0. Add Two Numbers.
Sergey has forgotten how to count. Help him find the sum of two numbers.
Input:
The first two lines contain natural numbers (each from $0$ to $10^{18}$).
(Note that 64-bit integers are required: int in Python, long long in C++, long in Java and C#, int64 in Pascal, etc.)
Output:
Print a single number — the sum of these two numbers.
Examples:
110263085964514794
302951845836574401
413214931801089195
Below are examples of solutions to this problem in different programming languages:
Python
a = int(input())
b = int(input())
print(a + b)
C++
#include <iostream>
using namespace std;
int main()
{
long long a, b;
cin >> a;
cin >> b;
cout << a + b;
return 0;
}
Java
import java.io.*;
public final class Main
{
public static void main(String args[])
{
StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
long a, b;
st.resetSyntax();
st.eolIsSignificant(false);
st.wordChars(33, 255);
st.whitespaceChars(0, 32);
try {
st.nextToken(); a = Long.parseLong(st.sval);
st.nextToken(); b = Long.parseLong(st.sval);
System.out.println(a + b);
} catch (Exception x) {
System.exit(1);
}
}
}
Javascript (Node.js)
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let input = [];
rl.on('line', (line) => {
input.push(BigInt(line));
if (input.length === 2) {
console.log((input[0] + input[1]).toString());
rl.close();
}
});
Kotlin
import java.util.*
fun main(args: Array<String>) {
val sc = Scanner(System.`in`);
var a: Long = sc.next().toLong();
var b: Long = sc.next().toLong();
println(a + b);
}
PHP
<?php
list ($a) = fscanf(STDIN, "%ld");
list ($b) = fscanf(STDIN, "%ld");
print $a + $b . "\n";
?>
Go
package main
import "fmt"
func main(){
var a, b int64
fmt.Scan(&a)
fmt.Scan(&b)
fmt.Printf("%d\n", a + b)
}
Ruby
a = gets.chomp
b = gets.chomp
puts a.to_i + b.to_i
Rust
use std::io;
use std::io::Read;
fn main()
{
let mut instr = String::new();
io::stdin().read_to_string(&mut instr).expect("err");
let mut viter = instr.split_whitespace();
let a = viter.next().unwrap().parse::<i64>().expect("err");
let b = viter.next().unwrap().parse::<i64>().expect("err");
let c = a + b;
println!("{}", c);
}
C#
using System;
class MainClass
{
static void Main(string[] args)
{
long a = Int64.Parse(Console.ReadLine());
long b = Int64.Parse(Console.ReadLine());
Console.WriteLine("{0}", a + b);
}
}
PascalABC.NET
program sum;
var a, b, c : int64;
begin
readln(a);
readln(b);
c := a + b;
writeln(c);
end.