Home > Back-end >  I can't run the compiled, appear d returned 1 exit status
I can't run the compiled, appear d returned 1 exit status

Time:10-17

Bessie brain responsive, as if really see her number one number, she began to pay attention to every digital (0 \ ldots 90... 9) : each digital appeared in the process of counting how many times?

Given two integers MM and NN (1 \ \ leq leq M N \ leq 2 \ times 10 ^ 91 M or less N 2 x 10 or less or less
9
M and N - 5 \ \ leq times 10 ^ 5 N? M 5 x 10 or less
5
), a digital appeared many times,

Input format
Line 11: two integers separated by Spaces MM and NN,

The output format
Line 11:10 integers separated by Spaces, respectively digital 0 \ ldots 90... 9 in the sequence, the number of occurrences of the

Input and output sample
Enter the # 1 copy
129, 137,
Output # 1 copy
10 2 9 1 1 1 1 0 1





# include
# include
# include
Int main ()
{
Int m, n, I, j, d, c;
The scanf (" % d % d ", & amp; M, & amp; n);
Int b [10]={0};
For (I=m; i<=n; I++)
For (j=1; J<=10; J++)
{
If (i
{
For (c=j - 1; C> 0; C -)
{
D=I % 10;
I=I/10;
The switch (d)
{
Case: 0 b [0] + +; break;
Case 1: b [1] + +; break;
Case 2: b [2] + +; break;
Case 3: b [3] + +; break;
Case 4: b [4] + +; break;
Case 5: b [5] + +; break;
Case 6: b [6] + +; break;
Case 7: b [7] + +; break;
Case 8: b [8] + +; break;
Case 9: b [9] + +; break;
}
}
}
}
for(i=0; i<10; I++)
Printf (" % d, b [I]);
return 0;





}

CodePudding user response:

I modified in the loop body of the building Lord, in the changes here:
 d=I % 10; 
I=I/10;

Primarily this sentence: I=I/10; Modified the I, don't forget I loop in the outer loop scalar;

CodePudding user response:

 # include 
# include
# include

Int main ()
{
Unsigned int m, n, I, a boundary=2 * (unsigned int) pow (10, 9);
Int who [10]={0}, TMP.


The scanf (" % u % u ", & amp; M, & amp; n);

If (m & gt; N)
return -1;
If ((m & lt;=0 | | m & gt; A boundary)
| | (n & lt;=0 | | n & gt; A boundary)) {
return -1;
}

For (I=m; I & lt;=n; I++) {
TMP=I;

While (TMP) {
Who [10] TMP % + +;
TMP/=10;
}
}
for(i=0; i<10; I++)
Printf (" % d ", who [I]);

Putchar (10);
return 0;



# if 0

Int m, n, I, j, d, c;
int tmp;
The scanf (" % d % d ", & amp; M, & amp; n);
Int b [10]={0};

For (I=m; i<=n; I++) {
TMP=I;
While (TMP)
{
D=TMP % 10;
TMP TMP/=10;
The switch (d)
{
Case: 0 b [0] + +; break;
Case 1: b [1] + +; break;
Case 2: b [2] + +; break;
Case 3: b [3] + +; break;
Case 4: b [4] + +; break;
Case 5: b [5] + +; break;
Case 6: b [6] + +; break;
Case 7: b [7] + +; break;
Case 8: b [8] + +; break;
Case 9: b [9] + +; break;
}
}
}
for(i=0; i<10; I++)
Printf (" % d: % d \ n ", I, b [I]);
# if 0
For (j=1; J<=10; J++)
{
If (i
{
TMP=I;

//for (c=j - 1; C> 0; C -)
While (TMP)
{
D=TMP % 10;
TMP TMP/=10;
The switch (d)
{
Case: 0 b [0] + +; break;
Case 1: b [1] + +; break;
Case 2: b [2] + +; break;
Case 3: b [3] + +; break;
Case 4: b [4] + +; break;
Case 5: b [5] + +; break;
Case 6: b [6] + +; break;
Case 7: b [7] + +; break;
Case 8: b [8] + +; break;
Case 9: b [9] + +; break;
}
}
}
}
for(i=0; i<10; I++)
Printf (" % d: % d \ n ", I, b [I]);
return 0;

# endif

# endif

}


For your reference ~

CodePudding user response:

Thanks, but I this is I want to set, in order to separate the output of each number, I entered the choice,
  • Related