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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.