시도 횟수: 1회

해결한 시간: 00:03

문제 번역(GPT)

핵심 아이디어

<aside> 💡

$w$미터마다 중간에 하나씩 설치해야 하므로 $n - \lfloor n/w \rfloor$가 답.

</aside>

코드

#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
using namespace std;
typedef long long ll;

int n, w;

void solve()
{
    cin >> n >> w;
    cout << n-n/w <<"\\n";
}

signed main()
{
    FASTIO;
    int _tc; cin >> _tc;
    while (_tc--) solve();
    return 0;
}

복기