Codeforces Round 876 (Div. 2) 1839A. The Good Array Solution


  

Problem Link :  https://codeforces.com/contest/1839/problem/A

Solution in C++:

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int32_t main() {
  4. ios_base::sync_with_stdio(0);
  5. cin.tie(0);
  6. int t;
  7. cin >> t;
  8. while (t--) {
  9. int n , k ;
  10. cin >> n >> k ;
  11. int r = ( n + k - 1) / k ;
  12. if ((( n % k == 0) and k > 1) or n % k > 1 ) r ++ ;
  13. cout << r <<'\n' ;
  14. }
  15. return 0 ;
  16. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.