标签:++ freopen mes set open c++ 垃圾 while name
垃圾代码
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
int a,b,c,d;
long long v,t;
const int maxn=1e6+5;
int cnt[maxn];
int main()
{
//freopen("Input.txt","r",stdin);
int T;scanf("%d",&T);
while(T--)
{
scanf("%d%d%d%d%lld%lld",&a,&b,&c,&d,&v,&t);
if(a<c){swap(a,c);swap(b,d);}
if(v>=c){printf("%lld\n",1LL*(t/a+1)*b+(t/c+1)*d-1);continue;}
memset(cnt,0,sizeof cnt);
int i=0,tmp;
for(i=1;i<=c&&(tmp=(1LL*a*i)%c)!=0;++i)
{
cnt[i]=cnt[i-1];
if(tmp<=v&&tmp+v>=c)cnt[i]--;
if(tmp>v&&tmp+v<c)cnt[i]++;
//printf("%d\n",cnt[i]);
}
//printf("i=%d\n",i);
long long m=0;
long long tt=t/c*c;
if((tt/a+1)%i!=0)m=cnt[(int)(tt/a+1)%i-1];
//printf("m=%d\n",m);
m=1LL*(tt/a+1)/i*cnt[i-1]+m+tt/c+1;
//printf("m=%d\n",m);
if(t%a<t%c)
{
if(t%c-t%a>v)m++;
}
printf("%lld\n",1LL*(t/a+1)*b+(t/c+1)*d-m);
}
}
标签:++ freopen mes set open c++ 垃圾 while name
原文地址:https://www.cnblogs.com/maoruimas/p/9657107.html