Contest Round 33 Editorial: Emphasis on Algorithmic Thinking

A. Word Rearrangement This is a straightforward problem requiring only basic input/output handling. w1, w2 = input().split() print(w2) print(w1) B. Cooking Tangyuan The key idea is to simulate the process of using packages to fulfill cooking rounds. Each package contributes a fixed number of tangyuan, and excess can carry over. n, x, k = map(i ...

Posted on Sun, 17 May 2026 14:48:21 +0000 by Fjerpje

Two Algorithm Problems: Ring Position Simulation and Game Theory Analysis

Problem 1: Ring Position Simulation Description: There are $2n$ people standing in two rings of size $n$ each. They are numbered from $1$ to $2n$, where positions $1$ to $n$ form ring 1 and positions $n+1$ to $2n$ form ring 2. Both rings start counting from $1$ simultaneously. Ring 1 starts from person $1$, and ring 2 starts from person $n+1$. ...

Posted on Wed, 13 May 2026 03:15:34 +0000 by Canadian

Probability Calculation Strategy for Dice and Coin Scenarios

Problem Overview This problem involves calculating the winning probability in a game defined by two random processes: an N-sided die and a fair coin. The objective is to reach a specific threshold K starting from a value generated by the die roll. Game Mechanics Initialization: Roll an N-sided die. The outcome serves as the initial score, rang ...

Posted on Sun, 10 May 2026 18:48:19 +0000 by Roggan

C Programming Practice: Random Generation, Menu Systems, and Input Validation

Task 1: Generate Student IDs Based on Random Major Selection The following program generates five student IDs. Each ID starts with either 20256343 (for one major) or 20256136 (for another), followed by a four-digit number. The selection between majors is randomized. #include <stdio.h> #include <stdlib.h> #include <time.h> #de ...

Posted on Sun, 10 May 2026 09:06:22 +0000 by chucklarge

Weekly Contest 357 Solutions

Problem 2810 - Faulty Keeyboard Simulate the keyboard behavior as described. When encuontering character 'i', reverse the current string. class Solution { public: string finalString(string input) { string result = ""; for(char c : input) { if(c == 'i') { reverse(result.begin(), ...

Posted on Sun, 10 May 2026 02:00:36 +0000 by stone

Simulating 3D Hat Color Transformations with Cube Queries

A cube of side length n holds hats arranged in a 3D grid. Each hat has an uppercase letter color, initially G for green. Implementation uses an integer representation where 'A' maps to 1 and 'G' maps to 7 via the formula int(letter)-64. Supported operations within axis-aligned rectangular regions: Paint all hats within a specified sub‑cube wit ...

Posted on Sat, 09 May 2026 11:39:01 +0000 by HyperD

Laser Scanning Simulation Using a Simple Physics Engine in MATLAB

This article provides a simulation environment for modeling laser beams hitting object surfaces and the ground. Users can configure the laser range, resolution, object position, size, and rotation. Recently, we needed to analyze occlusions caused by objects in a laser scanner's background. Unable to find a suitable environment, we built one in ...

Posted on Thu, 07 May 2026 20:47:33 +0000 by Benmcfc

Position-Based Dynamics and Implicit Integration for Cloth Simulation

Position-Based Dynamics (PBD) In a cloth simulation, each particle is influenced by gravity when external forces like collisions or spring constraints are ignored. The velocity and position are updated accordingly: float dt = 0.0333f; float damping = 0.99f; Vector3[] positions; // X Vector3[] velocities; // V Vector3 g = new Vector3(0.0f, -9.8f ...

Posted on Thu, 07 May 2026 10:49:05 +0000 by shadowk