Posted on Leave a comment

Interval sum [a, b]

[https://telegra.ph/UniLecs-127-Intervalnaya-summa-09-16]

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
	}
}
Posted on Leave a comment

culture

LingvoLive

French kiss – французский поцелуй. Французов всегда считали главными сладострастниками. Впрочем, любят французы и поесть: отсюда French toasts (гренки), French bread (хлеб «багет») и (неожиданно!) French fries (картофель фри)

Continue reading culture

Posted on Leave a comment

Android: Things every beginner should know

Things every beginner should know

1. Difference between @+id and @id
2. Using @string res for providing Strings in XML
3. Using @android and ?attr constants
4. Difference between SP and DP
5. Use of Drawables and Mipmaps
6. Using Vector Drawables
7. Setting End/Start Margin
8. Using Getter/Setter Generator
9. Using Override/Implement Generator
10. Understanding Contexts Properly