Decrements the maximum number of n digits to 1Time limit:3000/1000ms (java/other) Memory limit:65535/32768k (Java/other) total submission (s): ACC epted Submission (s): 4Font:Times New Roman|Verdana|GeorgiaFont Size:←→Problem description, given a number n,m, decrements the number of first M of the maximum n digits to 1, for example, 2 5, printing 99 98 97 96 95. Input inputs contain multiple sets of sample samples.
For each test case, enter a number n,m (N<=10^3,1<=m<=min ((10^n) -1,10^3)). Output corresponds to each test case and prints the first m bits from the largest n digits to 1, in turn. Sample Input
1 9
Sample Output
987654321
Author Wu Yu Statistic | Submit | Back
Bored to do the other schools out of the problem,
The problem made me exhausted. Because I can't find a problem on the avionics, I don't write the question number.
#include <stdio.h> #include <math.h>int main () {int n,m,temp,x;while (scanf ("%d%d", &n,&m)!=eof) { int flag=0; if (m<10) Temp=1;else if (m<100) Temp=2;else if (m<1000) Temp=3;else if (m<10000) Temp=4;int t=1;while (m--) { for (int i=0;i<n-temp;i++) printf ("9"), X=pow (10,temp)-t;if ((n-temp)) {for (int i=1;i<temp-(int) log10 (x); i++) printf ("0");} printf ("%d\n", x); t++;}} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Decrements the maximum number of n digits to 1 (2015 Jxnu_acs algorithm Group for the first time in summer Zhou Sai)