/ 科创班 /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 4ms 368.0 KiB
#2 Accepted 2ms 352.0 KiB
#3 Accepted 4ms 360.0 KiB
#4 Accepted 4ms 372.0 KiB
#5 Accepted 3ms 384.0 KiB
#6 Accepted 4ms 384.0 KiB
#7 Accepted 3ms 364.0 KiB
#8 Accepted 3ms 384.0 KiB
#9 Accepted 3ms 372.0 KiB

代码

#include <stdio.h>

int main()
{
    int v1, v2, t, s, l;
    scanf("%d%d%d%d%d", &v1, &v2, &t, &s, &l);
    
    int i, t1 = 0, t2 = l / v2;
    int s1 = 0, s2 = 0;
    for (i = 1; i <= t2; i++)
    {
        s2 += v2;
        if (t1 < i)
        {
            t1 = i;
            s1 += v1;
        }
        if (s1 == l)
            break;
        if (t1 == i && s1 - s2 >= t)
            t1 += s;
    }
    
    if (s1 == l && s2 == l)
        printf("D\n%d", t2);
    else if (s1 == l)
        printf("R\n%d", t1);
    else
        printf("T\n%d", t2);
    
    return 0;
}

信息

递交者
类型
递交
题目
龟兔赛跑预测
题目数据
下载
语言
C++
递交时间
2018-10-17 20:45:29
评测时间
2018-10-17 20:45:29
评测机
分数
100
总耗时
33ms
峰值内存
384.0 KiB