https://i2.wp.com/eblogarithm.com/wp-content/uploads/2017/04/Codeforces-Round-408-Div-2-problem-A-Buying-A-House-Solution-in-C1.png?fit=640%2C360

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 128 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: