题意:
问有效press次数,有效是指灯亮的时候有效
思路:
模拟时间器
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,c,d,t, v;
ll shinetime_;
long long cnt;
int main()
{
int T;
cin>>T;
while(T--)
{
ll nowb = 0,nowd = 0;
cnt = 0;
cin>>a>>b>>c>>d>>v>>t;
shinetime_ = v;
cnt += (b + d - 1);
while(nowb <= t || nowd <= t)
{
if(nowb + a <= nowd + c)
{
nowb += a;
if(nowb > t) continue;
if(nowb <= shinetime_)
{
cnt += b;
}
else
{
cnt += (b - 1);
}
shinetime_ = nowb + v;
}
else
{
nowd += c;
if(nowd > t) continue;
if(nowd <= shinetime_)
{
cnt += d;
}
else
{
cnt += (d - 1);
}
shinetime_ = nowd + v;
}
}
cout<<cnt<<endl;
}
return 0;
}