QM9B editorial

PROBLEM LINK:

Practice

Contest

Author: Chandan Boruah

Tester: Chandan Boruah

Editorialist: Chandan Boruah

DIFFICULTY:

EASY

PREREQUISITES:

Basic programming.

PROBLEM:

Given a number, find the number of unique ways in which it can be printed as a sum of two positive integers.

QUICK EXPLANATION:

Answer is number/2.

EXPLANATION:

Since the number of ways in which the number can expressed as sum of two positive integers is 1+(number-1), 2+(number-2) and so on. A time will come when in the sequence the order will reverse and it will be (number-1)+1 and (number-2)+2. So its number/2.

Solution in CS:

using System;
class some
{
	public static void Main()
	{
		int n=int.Parse(Console.ReadLine());
		while((n--)>0)
		{
			int k=int.Parse(Console.ReadLine());
			Console.WriteLine((k)/2);
		}
	}
}