QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#482325#7111. Press the ButtonlwenjWA 0ms3588kbC++14822b2024-07-17 18:56:182024-07-17 18:56:18

Judging History

你现在查看的是最新测评结果

  • [2024-07-17 18:56:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-07-17 18:56:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
	int a,b,c,d,v,t;
	cin>>a>>b>>c>>d>>v>>t;
	int g = __gcd(a,c);
	int B = a/g*c;
	int u = t%B;
	int ans=0;
	int l = 0;
	int k = 0;
	int si = 0;
	int c1 = 0, c2 = 0;

	for(int i = 0;i<B;){
		if(i == 0){
			ans += b+d-1;
			k = i+v;
		}
		else{
			if(i % a == 0){
				ans += b - 1;
				if(i<=k)ans++;
				k = i+v;
			}
			if(i%c==0){
				ans+=d-1;
				if(i<=k)ans++;
				k = i+v;
			}
		}
		
		if(i >= u) si = ans;
		
		 if ((c1 + 1) * a < (c2 + 1) * c) {
		 	i = (c1 + 1) * a;
		 	c1++;
		 }
		 else {
		 	i = (c2 + 1) * c;
		 	c2++;
		 }
	}
	int f = 0;
	if(k>=B){
		f= 1;
	}
	cout << t/B*ans+si+f*(t/B)<<endl;
}

signed main() 
{
	int t;
	cin >> t;
	while(t--)
		solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3588kb

input:

2
8 2 5 1 2 18
10 2 5 1 2 10

output:

10
4

result:

wrong answer 1st numbers differ - expected: '6', found: '10'