https://ac.nowcoder.com/acm/contest/5930/A
这道题给我整蒙了。。。
首先就是这道没说只考虑整数的时间点,不考虑小数
还有就是之后的代码不知道为什么有20%错误。。。
后来自己将小红的时间改为了l/v2就过了。。。
实在想不明白为啥。。。
#include <cstdio>
#include <queue>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
int main()
{
int v1,v2,t,s,l;//t mi s miao
int th=0,tm=0,sh=0,sm=0,ans=0;
scanf("%d %d %d %d %d",&v1,&v2,&t,&s,&l);
while(th<l&&tm<l)
{
if(tm-th>=t)
{
sh+=s;
th=sh*v2;
tm=v1*sm;
ans+=s;
}
else
{
++sh;
++sm;
ans++;
tm=v1*sm;
th=v2*sh;
}
}
if(tm>=l&&th>=l) printf("Tie %d\n",l/v2);
else if(tm>=l&&th<l) printf("Ming %d\n",ans);
else if(tm<l&&th>=l) printf("Hong %d\n",l/v2);
return 0;
}