codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1101A.md (948B)


      1 Source: https://codeforces.com/problemset/problem/1101/A
      2 
      3 A. Minimum Integer
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given $q$ queries in the following form:
     22 
     23 Given three integers $l_i$, $r_i$ and $d_i$, find minimum positive integer $x_i$ such that it is divisible by $d_i$ and it does not belong to the segment $[l_i, r_i]$.
     24 
     25 Can you answer all the queries?
     26 
     27 Recall that a number $x$ belongs to segment $[l, r]$ if $l \le x \le r$.
     28 
     29 Input
     30 
     31 The first line contains one integer $q$ ($1 \le q \le 500$) — the number of queries.
     32 
     33 Then $q$ lines follow, each containing a query given in the format $l_i$ $r_i$ $d_i$ ($1 \le l_i \le r_i \le 10^9$, $1 \le d_i \le 10^9$). $l_i$, $r_i$ and $d_i$ are integers.
     34 
     35 Output
     36 
     37 For each query print one integer: the answer to this query.
     38 
     39 Example
     40 
     41 Input
     42 
     43 ```
     44 5
     45 2 4 2
     46 5 10 4
     47 3 10 1
     48 1 2 3
     49 4 6 5
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 6
     56 4
     57 1
     58 3
     59 10
     60 ```