Home > Back-end >  Compile reported no errors, but there's no way to run
Compile reported no errors, but there's no way to run

Time:11-18

Bosses, please look at my code, compiled in devc without problems, but when I output data, the program has no output data, step by step I check found that I can't write into my program of BFS () function, but the BFS () this function is no problem, is this why? For help, bosses,
 # include 
using namespace std;
Typedef long long ll;
Const int N=1 e6 + 100;
Struct node
{
Int x [N];
int len;
};
Int k, n;

Ll KSM (int a, int b)
{
if(! B) return 1;
Ll temp=KSM (a, b/2);
If (b % 2) return temp * temp * a;
Return temp * temp;
}

Ll get_num (int a [], int len)
{
Ll sum=0;
for(int i=1; i<=len; I++)
The sum +=KSM (k, a [I]);//, printf (" % d ", a [I]);
//printf (" \ n % LLD \ n ", sum);
return sum;
}

Void BFS ()
{
//printf (" 1 \ n ");
Priority_queue & lt; Int> Res.
Queue q;
The node t;
T.l en=1, t.x [1]=0;
Q.p ush (t);
//printf (" % d \ n ", q.e mpty ());
while(! Q.e mpty ())
{
The node now=q.f ront ();
Q.p op ();
//printf (" % d \ n ", now, len);
Ll w=get_num (now. X, now. Len);
Res. Push (w);
If (res) size ()==n)
{
Printf (" % LLD \ n ", res. The top ());
break;
}

For (int I=now. X [now. Len] + 1; i<=50; I++)
{
The node d;
D.l en=now. Len + 1;
D.x [d.l en]=I;
Q.p ush (d);
}
}
return ;
}

Int main ()
{
The scanf (" % d % d ", & amp; K, & amp; n);
//printf (" % d % d \ n ", k, n);
BFS ();

return 0;
}

CodePudding user response:

Input the two integers?

CodePudding user response:

Your res generics for int, but in the long long, compile time also hint?

CodePudding user response:

refer to the second floor qybao response:
your res generics for int, but in the long long, compile time also hint?
when change the types of res to type long long, is still the same, there's no way to enter the BFS () function
  • Related