Tag: sport programming
Interval sum [a, b]
[https://telegra.ph/UniLecs-127-Intervalnaya-summa-09-16]
[code]
using System;
public class Program
{
public static long SumOfRange(long a, long b)
{
long result = (a + b) * (b – a + 1) / 2;
return result;
}
public static void Main()
{
Console.WriteLine("UniLecs");
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(1, 2))); // 3
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(1, 3))); // 6
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(2, 4))); // 9
}
}
[/code]
Coding-savvy Russia students best China & US to win ‘programming world championship’
A Russian team from St. Petersburg State University has triumphed in the IBM-sponsored ACM International Collegiate Programming Contest (ICPC), beating 128 teams to win the “programming world championship” to Russia for a fifth straight year.
XOR, bit twiddling
Манипуляции с битами. Игра в истину [https://nuancesprog.ru/p/4597]
A | B | A xor B |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |