Quick actions

cmd+k|ctrl+k

Navigation

Languages

Robô

Snippet info

Language

C

Visibility

public

Author

fernandanoronha.coelho

Created

2019-05-15T17:32:30Z

Updated

2019-05-15T17:32:30Z

#include <stdio.h>



int main(void) {
    int x=0, y=0, p;
    char f;
   scanf("%c", &f);
   
   while(f!='S')
   {
       scanf("%d", &p);
       if(f=='C'){
           y=y+p;
       }
       if(f=='B'){
           y=y-p;
       }
       if(f=='D'){
           x=x+p;
       }
       if(f=='E'){
           x=x-p;
       }
       scanf("%c", &f);
   }
   
   int d;
   d=((x-0)*(x-0))+((y-0)*(y-0));
   d=sqrt(d);
   printf("%d\n", d);
   
    return 0;
}
INFO