Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rate_limit_delay": 2,
"max_problems": 10,
"paths": {
"root": "C:\\Users\\DELL\\Desktop\\codeforces-scraper",
"data": "data",
"problems": "data/problems",
"editorials": "data/editorials",
"metadata": "data/metadata",
"docs": "docs",
"samples": "data/samples"
},
"selenium": {
"headless": true,
"timeout": 10
}
}
1 change: 1 addition & 0 deletions data/editorials/1352A.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1352A - Sum of Round Numbers Tutorial1352A - Sum of Round NumbersFirstly, we need to understand the minimum amount of round numbers we need to represent 𝑛. It equals the number of non-zero digits in 𝑛. Why? Because we can "remove" exactly one non-zero digit in 𝑛 using exactly one round number (so we need at most this amount of round numbers) and, on the other hand, the sum of two round numbers has at most two non-zero digits (the sum of three round numbers has at most three non-zero digits and so on) so this is useless to try to remove more than one digit using the sum of several round numbers.So we need to find all digits of 𝑛 and print the required number for each of these digits. For example, if 𝑛=103 then 𝑛=1⋅102+0⋅101+3⋅100, so we need two round numbers: 1⋅102 and 3⋅100.Because the last digit of 𝑛 is 𝑛%10 (the remainder of 𝑛 modulo 10) and we can remove the last digit of the number by integer division on 10, we can use the following code to solve the problem:int n;cin >> n;vector<int> ans;int power = 1;while (n > 0) { if (n % 10 > 0) { ans.push_back((n % 10) * power); } n /= 10; power *= 10;}cout << ans.size() << endl;for (auto number : ans) cout << number << " ";cout << endl; Solution#include <bits/stdc++.h>
37 changes: 37 additions & 0 deletions data/problems/1352A.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
A positive (strictly greater than zero) integer is called round if it is of the form d00...0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all numbers from 1
to 9
(inclusive) are round.

For example, the following numbers are round: 4000
, 1
, 9
, 800
, 90
. The following numbers are not round: 110
, 707
, 222
, 1001
.

You are given a positive integer n
(1≤n≤104
). Represent the number n
as a sum of round numbers using the minimum number of summands (addends). In other words, you need to represent the given number n
as a sum of the least number of terms, each of which is a round number.

Input
The first line contains an integer t
(1≤t≤104
) — the number of test cases in the input. Then t
test cases follow.

Each test case is a line containing an integer n
(1≤n≤104
).

Output
Print t
answers to the test cases. Each answer must begin with an integer k
— the minimum number of summands. Next, k
terms must follow, each of which is a round number, and their sum is n
. The terms can be printed in any order. If there are several answers, print any of them.
31 changes: 31 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Codeforces Problem Scraper

## Overview
This tool scrapes problem statements and editorials from Codeforces, preserving LaTeX formatting and code blocks.

## Features
- Extracts problem statements with preserved LaTeX formatting
- Captures test cases and sample inputs/outputs
- Preserves code blocks with proper formatting
- Stores metadata in JSON format
- Includes editorial content with proper section handling

## Project Structure
```
project/
├── data/
│ ├── problems/
│ ├── editorials/
│ ├── metadata/
│ └── samples/
└── docs/
```

## Usage
Run `main.py` to start the scraper:
```bash
python main.py
```

## Configuration
Settings can be modified in `config.json`
Loading