QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#469516 | #6706. Sekiro | mufeng12# | AC ✓ | 0ms | 3888kb | C++14 | 1.7kb | 2024-07-09 19:53:43 | 2024-07-09 19:53:44 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(x) (x).begin(),(x).end()
#define maxint INT32_MAX
#define minint INT32_MIN
#define maxll INT64_MAX
#define minll INT64_MIN
#define nc() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
#pragma GCC optimize(2)
void write(int x);
char *p1,*p2,buf[100000];
int read();
ll ksm(ll a,ll b,ll mod);
int js(int a,int b,int c){
int ans1,ans;
ans1=a+b>a*b?a+b:a*b;
ans=ans1+c>ans1*c?ans1+c:ans1*c;
return ans;
}
void solve(){
ll n,m;
cin>>n>>m;
m=min(m,(ll)log2(n)+1);
while(n&&m){
n=(n+1)/2;
m--;
}
cout<<n<<endl;
}
int main() {
int t=1;
cin>>t;
while(t--) solve();
return 0;
}
void write(int x)
{
if(x<0)
putchar('-'),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
return;
}
int read()
{
int x=0,f=1;
char ch=nc();
while(ch<48||ch>57)
{
if(ch=='-')
f=-1;
ch=nc();
}
while(ch>=48&&ch<=57)
x=x*10+ch-48,ch=nc();
return x*f;
}
ll ksm(ll a,ll b,ll mod){
ll ans=1;
a%=mod;
while(b>0){
if(b&1) ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
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: 0
Accepted
time: 0ms
memory: 3888kb
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:
108144 8 1 24 1 46574 5379 8122318 214413 1 1 1 1 1284902 1 18 20041088 1 21246753 5480 553 226 3877013 3162838 1 1 0 330619747 1168178 1 10463 1 2 0 1 0 1 1 91795 22918685 0 364 26026 66 1 4 15291 1 1 10 0 35435061 1 1 13899 1 6616 1 117 1 30576 1 1 101267710 1 1 4428 1 37192038 620 1 0 11 3551 1 4...
result:
ok 1000 numbers