From 8e05300ebaa32dddec3e4a22a98c5f7c689e0ca9 Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Tue, 11 Jul 2023 01:29:06 +0600 Subject: [PATCH] initial commit --- 1426A Floor Number/1426A.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 1426A Floor Number/1426A.cpp diff --git a/1426A Floor Number/1426A.cpp b/1426A Floor Number/1426A.cpp new file mode 100644 index 0000000..105f5c8 --- /dev/null +++ b/1426A Floor Number/1426A.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +using ll = long long; + +void solve() +{ + int n, x; + cin >> n >> x; + if (n < 3) + cout << "1" << endl; + else + { + n = n - 2; + int f; + if (n % x == 0) + f = n / x + 1; + else + f = n / x + 2; + cout << f << endl; + } +} + +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + + int TC = 1; + cin >> TC; + cin.ignore(); + while (TC--) + solve(); +} \ No newline at end of file