QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#124662#6568. Space AlignmentSommohito#WA 0ms3508kbC++20980b2023-07-15 12:59:062023-07-15 12:59:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-15 12:59:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3508kb
  • [2023-07-15 12:59:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
#define ALL(x) x.begin(),x.end()

void TEST_CASES()
{
    ll n,d;
    cin>>n>>d;
    if(n==1)
    {
        cout<<0<<"\n";
        return;
    }
    int ans=1e9;
    for(int s=1;s<=62;s++)
    {
        ll x=1LL<<s;
        ll now=n;
        int cnt=0;
        while(now>1)
        {
            now=(now+x-1)/x;
            cnt++;
        }
        if(cnt<=d)
        {
            ans=min(ans,cnt*s);
        }
    }
    cout<<ans<<"\n";
}


/*
1000000000000000000
*/

int32_t main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int t=1;
    cin>>t;
    while(t--)
    {
        TEST_CASES();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3508kb

input:

10
{
ss{
sts{
tt}
t}
t{
ss}
}
{
}

output:

0
0
0
0
0
0
0
0
0
0

result:

wrong answer 1st lines differ - expected: '2', found: '0'