QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253947#6706. SekiroLionel_ZQY#TL 0ms3700kbC++20377b2023-11-17 20:40:132023-11-17 20:40:14

Judging History

你现在查看的是最新测评结果

  • [2023-11-17 20:40:14]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3700kb
  • [2023-11-17 20:40:13]
  • 提交

answer

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

void solve(){
	i64 n,k;
	cin>>n>>k;
	while(k--){
		if(n%2==0) n/=2LL;
		else if(n!=1) n=(n+1LL)/2LL;
		else{
			n=1;
			break;
		}
	}
	cout<<n<<'\n';

}

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

	int t;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3700kb

input:

4
10 1
7 1
10 2
7 2

output:

5
4
3
2

result:

ok 4 number(s): "5 4 3 2"

Test #2:

score: -100
Time Limit Exceeded

input:

1000
442956297 12
982332962 27
497083098 816382285
396247623 24
898041447 407271792
763055147 14
352462601 16
519828345 6
219558285 10
325702476 354976208
490357788 107179876
390383594 636902929
169308923 21552242
657869544 9
435305129 833496936
300697250 24
320657401 4
896954688 877519779
679896094...

output:


result: