dhk.... 이걸 어떻게 풀지 싶었음
수학 문제 같다.. 증맬
처음에 막 어쩌구 해서 생각한 다음 저 식이 나왔는데 틀려서 다음 문제로 넘어갔음
다시 보니 좀 알 것 같았다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define xx first
#define yy second
using namespace std;
using i64 = long long;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
int main() {
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
i64 n, k;
scanf("%lld %lld", &n, &k);
i64 ans = k/(n-1)*n + k%(n-1);
if (k%(n-1) == 0)
ans--;
printf("%lld\n", ans);
}
return 0;
}
'코드포스' 카테고리의 다른 글
[코드포스 Practice21] C. Little Artem and Matrix (0) | 2020.06.06 |
---|---|
[코드포스 Practice21] B. Alice and Hairdresser (0) | 2020.06.06 |
[코드포스 Practice21] 후기 (0) | 2020.06.06 |
[코드포스 Practice20] E. Tram (0) | 2020.06.02 |
[코드포스 Practice20] D. BerOS File Suggestion (0) | 2020.05.29 |