Home > Back-end >  Why run time is too long
Why run time is too long

Time:10-13

# include
using namespace std;
Int main () {
Int m, n, I, j=0, jishu [100]={0}, oushu [100]={0};
While (cin & gt;> M & gt;> N) {
For (I=m; i !=n + 1; I++) {
If ((i& 1)==0)
Oushu [j] +=I * I;
The else
Jishu [j] +=I * I * I;
}
j++;
}
For (I=0; i !=j; I++)
cout return 0;
}

CodePudding user response:

Program is not complicated, you should consider whether there is a dead loop, while not out here

CodePudding user response:

Because
For (I=m; i !=n + 1; I++)
If m initial value is greater than or equal to n't exit the loop

CodePudding user response:

Honestly I & lt; M=don't look wise

CodePudding user response:

The
reference 3 floor lin5161678 response:
honestly I & lt; Don't look wise=m

The book suggested using c + +!=

CodePudding user response:

refer to the second floor gouyanfen response:
for
For (I=m; i !=n + 1; I++)
If m initial value is greater than or equal to n't exit the loop

This problem is to ensure m smaller than n

CodePudding user response:

The
reference X 4 floor? Y? J response:
Quote: reference lin5161678 reply: 3/f
honestly I & lt; Don't look wise=m

The book suggested using c + +!=
out of context, either you
Either this book perpetuated this misunderstanding
You pick a
As for the subject to ensure m So the title?

CodePudding user response:

The
reference X 5 floor? Y? J response:
Quote: refer to the second floor gouyanfen response:
for
For (I=m; i !=n + 1; I++)
If m initial value is greater than or equal to n't exit the loop

This problem is to ensure m smaller than n

How that value is entered, the program design must consider accidents, logic to rigorous, this is your training process,
  • Related