AtCoder Beginner Contest 059 Problem Solutions
Problem A: Enitial Letter Extraction
Given three space-separated lowercase strings, output their initial letters in uppercase.
std::string s; std::getline(std::cin, s);
for (int i = 0; i < (int)s.size(); i++) {
if (i == 0 || s[i - 1] == ' ') std::cout << char(s[i] - 'a' + 'A');
}
std::cout << "\n";
Problem B: Large ...
Posted on Fri, 02 Oct 2026 16:54:42 +0000 by joshmpratt
AtCoder Beginner Contest 005 Solutions
Problem A
Given two positive integers \(x\) and \(y\), compute \(\left\lfloor \frac{y}{x} \right\rfloor\).
Problem B
Given a sequence of integers \(a_1, a_2, \ldots, a_n\), output the minimum value among them.
Problem C
Problem Statement
Each takoyaki remains fresh for exactly \(T\) seconds after being cooked. There are \(N\) takoyakis cooked a ...
Posted on Fri, 02 Oct 2026 16:15:08 +0000 by mmonaco
Codeforces Round 1054 (Div. 3) Solutions
A. Be Positive
Count how many elements are negative. If the amount is odd, flip one more element so the product becomes positive.
void solve() {
int n; cin >> n;
int neg = 0;
for (int i = 0; i < n; ++i) {
int v; cin >> v;
if (v < 0) ++neg;
}
cout << (neg & 1 ? neg + 1 : neg) <&l ...
Posted on Tue, 29 Sep 2026 16:55:02 +0000 by cunoodle2
Optimizing Tower of Hanoi Variants, Cyclic Rearrangements, and Ranking Distributions
Constrained Tower Moves
A variation of the Tower of Hanoi requires moving all disks in the order (1\rightarrow 2\rightarrow 3\rightarrow 1). Given (n) disks on peg (1), determine the number of moves (a) to transfer them all to peg (2), and (b) to peg (3), modulo (998244353). Multiple queries ask for the XOR-sum of all (a) and (b) after taking t ...
Posted on Tue, 29 Sep 2026 16:33:35 +0000 by beginPHP
Finding the Champion in a Tournament
Given a tournament with n teams numbered from 0 to n - 1, determine the champion based on match results represented in an n x n boolean matrix.
Each element grid[i][j] indicates whether team i defeats team j. If grid[i][j] is 1, then team i is stronger than team j. Otherwise, team j is stronger than team i. A champion is a team that no other te ...
Posted on Tue, 29 Sep 2026 16:31:56 +0000 by impressthenet
Merging Video Segments to Cover a Time Range
Problem Overview
Given multiple video segments from a sports event lasting T seconds, each segment is represented as [start, end]. These segments may overlap and have varying lengths. We can freely split and recombine segments—for instance, [0, 7] can be divided into [0, 1] + [1, 3] + [3, 7].
The objective is to recombine these segments to crea ...
Posted on Wed, 23 Sep 2026 16:12:59 +0000 by mbuckley2000
Educational Codeforces Round 158 (Rated for Div. 2) - Virtual Participation Notes
A. Line Trip
The fuel tank must be sufficient to cover the distance between every pair of consecutive gas stations, and must also allow returning from the destination back to the start point without refueling at the final station.
Click to view solution code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_st ...
Posted on Mon, 21 Sep 2026 16:54:37 +0000 by bubbadawg
SMU Summer 2023 Programming Contest: Solutions
This document provides solutions for problems from the SMU Summer 2023 Contest, Round 6.
A. Burger Optimization
This problem involves maximizing profit from selling two types of burgers with different ingredients and prices, given a limited number of buns. The strategy is to iterate through all possible counts of the first burger type, up to th ...
Posted on Sat, 12 Sep 2026 16:45:31 +0000 by ccx004
Minimum Cowphabet Sing-throughs for an Observed String
A cow's language, known as Cowphabet, consists of the 26 lowercase letters. However, the order in which a cow recites these letters is a permutation of the standard alphabet sequence. Bessie repeats this song, and Farmer John notes down a string of letters he remembers hearing. The task is to determine the minimum number of complete Cowphabet r ...
Posted on Sun, 06 Sep 2026 16:17:46 +0000 by Bit343
ABC 046 Solutions: Counting, Coloring, Votes and RPS
A – Distinct Count
Input three integers. Output how many different values appear.
#include <bits/stdc++.h>
using namespace std;
int main() {
set<int> bag;
for (int i = 0; i < 3; ++i) {
int x; cin >> x;
bag.insert(x);
}
cout << bag.size() << '\n';
}
B – Coloring a Line of Balls
G ...
Posted on Sat, 05 Sep 2026 16:05:44 +0000 by adrian_quah