社区讨论
求助!
学术版参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @m6uhc2sv
- 此快照首次捕获于
- 2025/02/07 16:03 去年
- 此快照最后确认于
- 2025/11/04 09:49 4 个月前
CPP
#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,看不懂
回复
共 1 条回复,欢迎继续交流。
正在加载回复...