Home > database >  C # level 1 subject
C # level 1 subject

Time:09-25

The number of single digit within 10000 thousand digits on number and the reduction figures on the number of reducing the number of ten digits number greater than zero on CNT, put all meet the conditions of four digits in sequence in the array b, then the four digits of the array b according to the order from big to small sort, finally calling function to output the results,

CodePudding user response:

ArrayList al=new ArrayList ();
Int a=new int [] [6].
//a [5]=[4] a * 1000 * 100 + a + a [3] [2] * 10 + a, [1].
int sum=0;
For (int I=9999; I & gt; 1000; I -)
{
A [4]=I/1000;
A [3]=(I - a [4] * 1000)/100;
A [2]=(I - a [4] [3] * 100 * 1000 - a)/10;
A [1]=I - a [4] [3] * 100 * 1000 - a - a, [2] * 10.
If (a [1] - [3] a [2] - a - a [4] & gt; 0)
{
Al. Add (I);
The sum +=1;//the number of meet the requirements,
}
}
}
  • Related