Skip to content

Instantly share code, notes, and snippets.

@phaser
phaser / CF_285B.cs
Created September 4, 2017 06:33
Solution to CodeForces 285 B problem.
using System;
public class CF_285B
{
public int solve(int[] p, int s, int t)
{
s--; t--;
for (int i = 0; i < p.Length; p[i]--, i++) { }
int cp = s;
int numelems = 0;
@phaser
phaser / CF_755A.cs
Created September 4, 2017 06:32
Solution to CodeForces 755/A problem.
using System;
public class CF_755A
{
static int Main(string[] args)
{
uint n = Convert.ToUInt32(Console.ReadLine());
Console.WriteLine(new CF_755A().solve(n));
return 0;
}
import std.stdio;
import core.stdc.stdio;
import std.string;
import std.algorithm;
public class Item
{
public int value;
public int weight;
}
import std.stdio;
import std.uni;
import std.string;
import core.stdc.stdio;
import std.array;
import std.algorithm;
import std.string;
import std.math;
class Summator
template <class Fun>
class ScopeGuard {
Fun f_;
bool active_;
public:
ScopeGuard(Fun f)
: f_(std::move(f))
, active_(true) {
}
~ScopeGuard() { if (active_) f_(); }