|
| 1 | +import java.text.DecimalFormat; |
| 2 | +import java.util.stream.LongStream; |
| 3 | +import java.util.stream.IntStream; |
| 4 | +import java.io.*; |
| 5 | +import java.util.*; |
| 6 | + |
| 7 | +public class Main { |
| 8 | + |
| 9 | + public static void main(String[] args) { |
| 10 | + FastScanner sc = new FastScanner(); |
| 11 | + PrintWriter out = new PrintWriter(System.out); |
| 12 | + //int t = sc.nextInt(); |
| 13 | + // while(t-->0){ |
| 14 | + Naveen problem = new Naveen(sc); |
| 15 | + problem.solve(sc,out); |
| 16 | + //} |
| 17 | + out.flush(); |
| 18 | + } |
| 19 | + |
| 20 | +} |
| 21 | + |
| 22 | +class Naveen { |
| 23 | + |
| 24 | + int l,r,d; |
| 25 | + //int[] arr; |
| 26 | + |
| 27 | + |
| 28 | + Naveen(FastScanner sc) { |
| 29 | + |
| 30 | + l = sc.nextInt(); |
| 31 | + r = sc.nextInt(); |
| 32 | + d = sc.nextInt(); |
| 33 | + |
| 34 | + // arr = sc.arrayInt(n); |
| 35 | + } |
| 36 | + |
| 37 | + void solve(FastScanner sc ,PrintWriter out) { |
| 38 | + int cmm =0; |
| 39 | +for(int i =l;i<=r;i++){ |
| 40 | + if(i%d==0) cmm++; |
| 41 | + |
| 42 | + |
| 43 | +} |
| 44 | +out.println(cmm); |
| 45 | + |
| 46 | + |
| 47 | + } |
| 48 | + |
| 49 | + |
| 50 | +} |
| 51 | + |
| 52 | +class FastScanner { |
| 53 | + |
| 54 | + private final InputStream in = System.in; |
| 55 | + private final byte[] buffer = new byte[1024]; |
| 56 | + private int ptr = 0; |
| 57 | + private int buflen = 0; |
| 58 | + |
| 59 | + private boolean hasNextByte() { |
| 60 | + if (ptr < buflen) { |
| 61 | + return true; |
| 62 | + } else { |
| 63 | + ptr = 0; |
| 64 | + try { |
| 65 | + buflen = in.read(buffer); |
| 66 | + } catch (IOException e) { |
| 67 | + e.printStackTrace(); |
| 68 | + } |
| 69 | + if (buflen <= 0) { |
| 70 | + return false; |
| 71 | + } |
| 72 | + } |
| 73 | + return true; |
| 74 | + } |
| 75 | + |
| 76 | + private int readByte() { |
| 77 | + if (hasNextByte()) { |
| 78 | + return buffer[ptr++]; |
| 79 | + } else { |
| 80 | + return -1; |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + private static boolean isPrintableChar(int c) { |
| 85 | + return 33 <= c && c <= 126; |
| 86 | + } |
| 87 | + |
| 88 | + public boolean hasNext() { |
| 89 | + while (hasNextByte() && !isPrintableChar(buffer[ptr])) { |
| 90 | + ptr++; |
| 91 | + } |
| 92 | + return hasNextByte(); |
| 93 | + } |
| 94 | + |
| 95 | + public String next() { |
| 96 | + if (!hasNext()) { |
| 97 | + throw new NoSuchElementException(); |
| 98 | + } |
| 99 | + StringBuilder sb = new StringBuilder(); |
| 100 | + int b = readByte(); |
| 101 | + while (isPrintableChar(b)) { |
| 102 | + sb.appendCodePoint(b); |
| 103 | + b = readByte(); |
| 104 | + } |
| 105 | + return sb.toString(); |
| 106 | + } |
| 107 | + |
| 108 | + public long nextLong() { |
| 109 | + if (!hasNext()) { |
| 110 | + throw new NoSuchElementException(); |
| 111 | + } |
| 112 | + long n = 0; |
| 113 | + boolean minus = false; |
| 114 | + int b = readByte(); |
| 115 | + if (b == '-') { |
| 116 | + minus = true; |
| 117 | + b = readByte(); |
| 118 | + } |
| 119 | + if (b < '0' || '9' < b) { |
| 120 | + throw new NumberFormatException(); |
| 121 | + } |
| 122 | + while (true) { |
| 123 | + if ('0' <= b && b <= '9') { |
| 124 | + n *= 10; |
| 125 | + n += b - '0'; |
| 126 | + } else if (b == -1 || !isPrintableChar(b)) { |
| 127 | + return minus ? -n : n; |
| 128 | + } else { |
| 129 | + throw new NumberFormatException(); |
| 130 | + } |
| 131 | + b = readByte(); |
| 132 | + } |
| 133 | + } |
| 134 | + |
| 135 | + public int nextInt() { |
| 136 | + long nl = nextLong(); |
| 137 | + if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) { |
| 138 | + throw new NumberFormatException(); |
| 139 | + } |
| 140 | + return (int) nl; |
| 141 | + } |
| 142 | + |
| 143 | + public double nextDouble() { |
| 144 | + return Double.parseDouble(next()); |
| 145 | + } |
| 146 | + |
| 147 | + public int[] arrayInt(int N) { |
| 148 | + int[] array = new int[N]; |
| 149 | + for (int i = 0; i < N; i++) { |
| 150 | + array[i] = nextInt(); |
| 151 | + } |
| 152 | + return array; |
| 153 | + } |
| 154 | + |
| 155 | + public long[] arrayLong(int N) { |
| 156 | + long[] array = new long[N]; |
| 157 | + for (int i = 0; i < N; i++) { |
| 158 | + array[i] = nextLong(); |
| 159 | + } |
| 160 | + return array; |
| 161 | + } |
| 162 | + |
| 163 | + public double[] arrayDouble(int N) { |
| 164 | + double[] array = new double[N]; |
| 165 | + for (int i = 0; i < N; i++) { |
| 166 | + array[i] = nextDouble(); |
| 167 | + } |
| 168 | + return array; |
| 169 | + } |
| 170 | + |
| 171 | + public String[] arrayString(int N) { |
| 172 | + String[] array = new String[N]; |
| 173 | + for (int i = 0; i < N; i++) { |
| 174 | + array[i] = next(); |
| 175 | + } |
| 176 | + return array; |
| 177 | + } |
| 178 | + |
| 179 | + public int randomInt() { |
| 180 | + Random r = new Random(); |
| 181 | + int value = r.nextInt((int) 1e6); |
| 182 | + System.out.println(value); |
| 183 | + return value; |
| 184 | + } |
| 185 | + |
| 186 | + public int[] randomInt(int N) { |
| 187 | + int[] array = new int[N]; |
| 188 | + Random r = new Random(); |
| 189 | + for (int i = 0; i < N; i++) { |
| 190 | + array[i] = r.nextInt((int) 1e6); |
| 191 | + } |
| 192 | + System.out.println(Arrays.toString(array)); |
| 193 | + return array; |
| 194 | + } |
| 195 | + |
| 196 | +} |
| 197 | + |
| 198 | +class My { |
| 199 | + |
| 200 | + public static long lower(long arr[],long key){ |
| 201 | + int low = 0; |
| 202 | + int high = arr.length-1; |
| 203 | + while(low < high){ |
| 204 | + int mid = low + (high - low)/2; |
| 205 | + if(arr[mid] >= key){ |
| 206 | + high = mid; |
| 207 | + } |
| 208 | + else{ |
| 209 | + low = mid+1; |
| 210 | + } |
| 211 | + } |
| 212 | + return low; |
| 213 | + } |
| 214 | +public static int upper(int arr[],int key){ |
| 215 | + int low = 0; |
| 216 | + int high = arr.length-1; |
| 217 | + while(low < high){ |
| 218 | + int mid = low + (high - low+1)/2; |
| 219 | + if(arr[mid] <= key){ |
| 220 | + low = mid; |
| 221 | + } |
| 222 | + else{ |
| 223 | + high = mid-1; |
| 224 | + } |
| 225 | + } |
| 226 | + return low; |
| 227 | +} |
| 228 | + static void ans(boolean b) { |
| 229 | + System.out.println(b ? "Yes" : "No"); |
| 230 | + } |
| 231 | + |
| 232 | + static void ANS(boolean b) { |
| 233 | + System.out.println(b ? "YES" : "NO"); |
| 234 | + } |
| 235 | + |
| 236 | + static String sort(String s) { |
| 237 | + char[] ch = s.toCharArray(); |
| 238 | + Arrays.sort(ch); |
| 239 | + return String.valueOf(ch); |
| 240 | + } |
| 241 | + |
| 242 | + static String reverse(String s) { |
| 243 | + return new StringBuilder(s).reverse().toString(); |
| 244 | + } |
| 245 | + |
| 246 | + static int[] reverse(int[] array) { |
| 247 | + for (int i = 0; i < array.length / 2; i++) { |
| 248 | + int temp = array[i]; |
| 249 | + array[i] = array[array.length - 1 - i]; |
| 250 | + array[array.length - 1 - i] = temp; |
| 251 | + } |
| 252 | + return array; |
| 253 | + } |
| 254 | + |
| 255 | + static long[] reverse(long[] array) { |
| 256 | + for (int i = 0; i < array.length / 2; i++) { |
| 257 | + long temp = array[i]; |
| 258 | + array[i] = array[array.length - 1 - i]; |
| 259 | + array[array.length - 1 - i] = temp; |
| 260 | + } |
| 261 | + return array; |
| 262 | + } |
| 263 | + |
| 264 | + static double[] reverse(double[] array) { |
| 265 | + for (int i = 0; i < array.length / 2; i++) { |
| 266 | + double temp = array[i]; |
| 267 | + array[i] = array[array.length - 1 - i]; |
| 268 | + array[array.length - 1 - i] = temp; |
| 269 | + } |
| 270 | + return array; |
| 271 | + } |
| 272 | + |
| 273 | + static String[] reverse(String[] array) { |
| 274 | + for (int i = 0; i < array.length / 2; i++) { |
| 275 | + String temp = array[i]; |
| 276 | + array[i] = array[array.length - 1 - i]; |
| 277 | + array[array.length - 1 - i] = temp; |
| 278 | + } |
| 279 | + return array; |
| 280 | + } |
| 281 | + |
| 282 | + static char[] reverse(char[] array) { |
| 283 | + for (int i = 0; i < array.length / 2; i++) { |
| 284 | + char temp = array[i]; |
| 285 | + array[i] = array[array.length - 1 - i]; |
| 286 | + array[array.length - 1 - i] = temp; |
| 287 | + } |
| 288 | + return array; |
| 289 | + } |
| 290 | + |
| 291 | + static long min(long... numbers) { |
| 292 | + Arrays.sort(numbers); |
| 293 | + return numbers[0]; |
| 294 | + } |
| 295 | + |
| 296 | + static int min(int... numbers) { |
| 297 | + Arrays.sort(numbers); |
| 298 | + return numbers[0]; |
| 299 | + } |
| 300 | + |
| 301 | + static double min(double... numbers) { |
| 302 | + Arrays.sort(numbers); |
| 303 | + return numbers[0]; |
| 304 | + } |
| 305 | + |
| 306 | + static long max(long... numbers) { |
| 307 | + Arrays.sort(numbers); |
| 308 | + return numbers[numbers.length - 1]; |
| 309 | + } |
| 310 | + |
| 311 | + static int max(int... numbers) { |
| 312 | + Arrays.sort(numbers); |
| 313 | + return numbers[numbers.length - 1]; |
| 314 | + } |
| 315 | + |
| 316 | + static double max(double... numbers) { |
| 317 | + Arrays.sort(numbers); |
| 318 | + return numbers[numbers.length - 1]; |
| 319 | + } |
| 320 | + |
| 321 | + static int sum(long number) { |
| 322 | + int sum = 0; |
| 323 | + while (number > 0) { |
| 324 | + sum += number % 10; |
| 325 | + number /= 10; |
| 326 | + } |
| 327 | + return sum; |
| 328 | + } |
| 329 | + |
| 330 | +} |
0 commit comments