Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char** argv) {
- int t,n,i,cont,index;
- scanf("%d",&t);
- while(t--){
- cont=0;/*origin*/
- scanf("%d",&n);
- int coord[n];
- char buff[15];
- for(i=0;i<n;i++){
- scanf("%s",&buff);
- if (strcmp(buff,"LEFT")==0){
- cont--;
- coord[i]=-1;
- }
- if(strcmp(buff,"RIGHT")==0){
- cont++;
- coord[i]=1;
- }
- if (strcmp(buff,"SAME")==0){
- scanf("%s %d",&buff,&index);
- cont+=coord[index-1];
- coord[i]=coord[index-1];
- }
- }
- printf("%d\n",cont);
- }
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement