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

By |2017-04-11T10:08:40+00:00April 11th, 2017|Categories: C/C++, Programming|Tags: , , |

#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; }