Codeforces Round #408 (Div. 2), problem: (A) Buying A House Solution in C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define MAX 1000000009

int main()
{
	int i,n,m,k,min=MAX,t,temp;
	scanf("%d %d %d",&n,&m,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&t);
		if(t>0 && t<=k)
		{
			temp=abs(m-i);
			if(temp<min)
				min=temp;
		}
	}
	printf("%d\n",(min*10));
	return 0;
}
(Visited 160 times, 1 visits today)

About the Author:

Leave A Comment