/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 764.0 KiB
#3 Wrong Answer 4ms 532.0 KiB

Code

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

long long findpower(long long y)
{
    long long x = floor(log2(y-1));
    return x;
}

void sir()
{
    long long n;
    cin>>n;
    if(n==1)
    {
        cout<<"0"<<endl;
    }
    else
    {
        long long x = findpower(n); //after qualifier, 2^x teams for knockout.
        long long match = n*(n-1)/2; // first round.
        for(long long i=x; i>=1; i--)
        {   
            n = pow(2,i); //new team every round.
            match += (n*(n-1))/2 ;
        }
        cout<<match<<endl;
    }
    
}

int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        sir();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1026 LUFA cup 2024
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-12 19:31:05
Judged At
2024-11-11 03:40:53
Judged By
Score
10
Total Time
4ms
Peak Memory
764.0 KiB