跳到正文

剪贴板

剪贴板 8yzzj8v3

O_O6
原文
剪贴板信息

剪贴板信息

发布
收录
更新

留言版/message  board\color{CornflowerBlue}{\mathtt{留言版/message~~board}}

这是作者最近找到的留言版!!!,有事情可以在这里留言哦qwq,会在这里回复。

考虑到某些智障不那么聪明的人士冒充作者,因此一切回复按这里为准

也许我会冒充别人冒充我

留言板\color{white}\colorbox{CornflowerBlue}{留言板}

回复区:

26-8-20

原文:

#include <bits/stdc++.h> using namespace std;

#define ll long long const int N = 2e5 + 5; int n, k, a[N];

int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

C++
int T = 1;
cin >> T;
while (T -- ){
	cin >> n >> k;
	if (n <= k){
		cout << n << "\n";
		continue;
	}
	
	int sum = 0, cnt = 0;
	for (int i = 0; i <= 20; i ++ ){
		int t = min(k, (n - sum) / (1 << i));
		cnt += t, sum += t * (1 << i);
	}
	cout << cnt << "\n";
}

}


不是哥们,偷偷传代码??don’t have face