Description 1, 2, 3 ... n this n (0<n<=1000000000) Number of numbers can be divisible by positive integer B.
-
-
Input
-
-
input contains multiple sets of data
Each group of data occupies a row, each row gives two positive integers n, b.
-
-
Output
-
-
outputs the corresponding results for each set of data.
-
-
Sample input
-
-
2 15 310 4
-
-
Sample output
-
212
If you try to remove B from the first number and then add one of the variables defined, the commit will show a timeout. Does it have a simple algorithm? Of course, if the other way of thinking, with the last number to remove B, the exact quotient is the required number, which will save more time. Isn't it amazing? But you have to think about what this is for?
1#include <stdio.h>2 3 intMain ()4 {5 unsigned a, n;6 while(SCANF ("%u%u", &n, &a)! =EOF)7 {8(A==1 printf ("%u\n", N): printf ("%u\n", n/a);9 }Ten return 0; One}
Number of divisible by science and technology