C. K-th Not Divisible by n1200 / 思维 找规律

Posted 幽殇默

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C. K-th Not Divisible by n1200 / 思维 找规律相关的知识,希望对你有一定的参考价值。


https://codeforces.com/problemset/problem/1352/C

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
int main(void)
{
	int t; cin>>t;
	while(t--)
	{
		LL n,k; cin>>n>>k;
		LL a=k%(n-1);
		if(!a) a=n-1;
		LL b=k/(n-1);
		if(k%(n-1)==0) b--;
		cout<<a+b*n<<endl;
	}
}

以上是关于C. K-th Not Divisible by n1200 / 思维 找规律的主要内容,如果未能解决你的问题,请参考以下文章

Leetcode 1018. Binary Prefix Divisible By 5

Binary Prefix Divisible By 5 LT1018

LeetCode --- 1018. Binary Prefix Divisible By 5 解题报告

LeetCode --- 1018. Binary Prefix Divisible By 5 解题报告

LeetCode --- 1018. Binary Prefix Divisible By 5 解题报告

LeetCode #974. Subarray Sums Divisible by K 数组