Home > Back-end >  I use a dynamic array, nothing very good ideas, test the sample, why WA?
I use a dynamic array, nothing very good ideas, test the sample, why WA?

Time:02-12

 
# include & lt; Iostream>
# include & lt; Cmath>
# include & lt; Cstring>
using namespace std;

Bool mark [1000000005];
Int n, s, e;
Void XXS ()
{
If (s==1)
S +=1;
For (int I=2; i <=e; I++)
{
if (! Mark [I])
{
For (int j=I * I; J & lt;=e; J +=I)
Mark [j]=1;
}
}
For (int I=s; i <=e; I++)
if (! Mark [I])
Cout & lt; }

Int main ()
{
//for (int I=2; i <=1000000005; I++)
//mark [I]=1;
Cin & gt;> n;
While (n -)
{
Cin & gt;> S & gt;> e;
Memset (mark, false, sizeof (mark));
XXS ();
Cout & lt; }
return 0;
}

Bosses, take A look at this WA code ( W onderful A nswer)

CodePudding user response:

No title, no wrong answers?

CodePudding user response:

Which is a dynamic array you this?
And you want to achieve what demand also didn't say clear, this is you want to find prime Numbers?

CodePudding user response:

refer to the second floor qybao response:
which is a dynamic array you this?
And you want to achieve what demand also didn't say clear, this is you want to find prime Numbers?

Copied directly from los valley posts, forget

UVA10474 Marble Where the Where is the Marble?

The question of translation
Existing N marble, marble on each wrote a nonnegative integer, first turn on the number of the smallest, and then back to a Q question, each question asked whether there is a marble reads an integer x, if so, to answer the marble on x, sorted marble numbered 1 to N from left to right,
  • Related