ACM (TJU) : 3232



#include <stdio.h>

int main ()
{
	int a, b, c;

	scanf ("%d %d %d", &a, &b, &c);

	int count = 0;

	if ( (c - b) > (b - a) ) {
	
		while ( (c - 1) != b ) {
			a = b;
			b = a + 1;
			count++;
		}
	}

	else {

		while ( (a + 1) != b ) {
			c = b;
			b = c - 1;
			count++;
		}
	}

	printf ("%d\n", count);

	return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s