求助!
  • 板块学术版
  • 楼主zphakder2
  • 当前回复1
  • 已保存回复1
  • 发布时间2025/2/7 16:01
  • 上次更新2025/2/7 18:35:05
查看原帖
求助!
1327809
zphakder2楼主2025/2/7 16:01
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<queue>
using namespace std;
struct AAA{int a,c;};
queue<AAA>q;
int main()
{
	int x1,x2,x3,cnt=0;
	cin >> x1 >> x2 >> x3;/*
	if(x1 == 680211&&x2 == 97&&x3 == 79)
	{
		cout << -1;
		return 0;
	}*/
	q.push({1,0});
	while(1)
	{
		int xx = q.front().a;
		if(xx > 1000000)
		{
			q.pop();
			continue;
		}
		int cx = q.front().c;
		if(xx == x1){cout << cx;return 0;}
		q.pop();
		q.push({xx+x2,cx+1});
		q.push({xx*x3+1,cx+1});
	}
	cout << -1;
}

求大神帮debug,当输入为680211,97,79时报错,本人是傻x,看不懂

2025/2/7 16:01
加载中...