Uva 11498 – Division of Nlogonia

Solution actually simple…You have to think simple

here is the cartesian co ordinate link check here then think
http://www.mathsisfun.com/data/cartesian-coordinates.html

Code with one technique

#include<stdio.h>
int main()
{
int k,n,m,x,y,i;
while(scanf("%d",&k)==1){
if(k==0)
break;
scanf("%d %d",&n,&m);
for(i=0;i<k;i++)
{
scanf("%d %d",&x,&y);
if(x==n || y==m){
    printf("divisa\n");
}
else if(x>n && y>m){
    printf("NE\n");
}
else if(x<n&&y>m){
    printf("NO\n");
}
else if(x<n&&y<m){
    printf("SO\n");
}
else if(x>n&&y<m){
    printf("SE\n");
}
}
}
return 0;
}

Code with another technique

#include<stdio.h>
int main()
{
int k,n,m,x,y,i;
for(;;){
scanf("%d",&k);
if(k==0)
break;
scanf("%d %d",&n,&m);
for(i=0;i<k;i++)
{
scanf("%d %d",&x,&y);
if(x==n || y==m){
    printf("divisa\n");
}
else if(x>n && y>m){
    printf("NE\n");
}
else if(x<n&&y>m){
    printf("NO\n");
}
else if(x<n&&y<m){
    printf("SO\n");
}
else if(x>n&&y<m){
    printf("SE\n");
}
}
}
return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.