M - Sekiro ZOJ - 4125

    xiaoxiao2025-04-21  6

    这个题按照题目的要求来做就OK了

    #include <iostream> #define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #include <cstdio> using namespace std; typedef long long ll; int main() { ll t,n,k,res; scanf("%lld",&t); while(t--) { scanf("%lld%lld",&n,&k); // if(k>=30) // { // cout<<1<<endl; // } if(n==0) { cout<<0<<endl; continue; } while(k) { res=n; n=n/2; if(n*2<res){ n=n+1; } if(n==1) { break; } k--; } printf("%lld\n",n); } return 0; }

     

    最新回复(0)