Codeforces Round 876 (Div. 2) 1839A. The Good Array Solution
Problem Link : https://codeforces.com/contest/1839/problem/A
Solution in C++:
- #include <bits/stdc++.h>
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- while (t--) {
- int n , k ;
- cin >> n >> k ;
- int r = ( n + k - 1) / k ;
- if ((( n % k == 0) and k > 1) or n % k > 1 ) r ++ ;
- cout << r <<'\n' ;
- }
- return 0 ;
- }
No comments