90pts WA 求调
  • 板块P3403 跳楼机
  • 楼主shuqiang
  • 当前回复1
  • 已保存回复1
  • 发布时间2025/7/1 13:22
  • 上次更新2025/7/1 22:14:11
查看原帖
90pts WA 求调
685964
shuqiang楼主2025/7/1 13:22
#include<iostream>
#include<queue>

using namespace std;
typedef unsigned long long ll;

const int N = 1e5 + 10;
int x, y, z; ll h, a[N], ans;
queue<ll> q;

int main(){
	cin >> h >> x >> y >> z; h--;
	q.push(y);
	q.push(z);
	while(q.size()){
		ll tp = q.front();
		q.pop();
		if(tp > h) continue;
		if(a[tp % x] % x == tp % x) continue;
		a[tp % x] = tp;
		q.push(tp+y);
		q.push(tp+z);
	}
	for(int i = 0; i < x; i++){
		if(a[i] % x == i) ans += (h-a[i])/x+1;
	}
	cout << ans;
	return 0;
} 
2025/7/1 13:22
加载中...