2 solutions

  • 0
    @ 2024-10-21 17:12:37

    #include <stdio.h> int main() { int v1,v2,t,s,l; int x1=0,x2=0,i=0; scanf("%d %d %d %d %d",&v1,&v2,&t,&s,&l); while(x1<l&&x2<l){ x1=x1+v1; x2=x2+v2; i++; if(x1l||x2l){ break; } if(x1-x2>=t){ x1-=v1*s; } } if(x1>x2){ printf("R\n"); printf("%d",i); } else if(x1==x2){ printf("D\n"); printf("%d",i); } else{ printf("T\n"); printf("%d",i); }
    return 0; }

    Information

    ID
    6819
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    67
    Accepted
    11
    Uploaded By