Submission #1819977


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
long n,t,a[12],cs,c,d,m,kq;
int main()
{
    cin >> t;
    while (t--){
        cin >> m >> n;
        cs=0;c=n;kq=0;d=0;
        for (int i=1;i<=10;i++) a[i]=0;
        if (m==1){
            cout << n << endl;
            continue;
        }
        while (c!=0){
            a[++cs]=c%2;
            c=c/2;
        }
        for (int i=7;i>=1;i--){
            if (a[i]==0) d=d+pow(2,i-1);
        }
        if (m%2==0) kq=127*(m-1)+d;
        else kq=127*(m-1)+n;
        cout << kq << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - Cookie Breeding Machine
User vjudge4
Language C++14 (GCC 5.4.1)
Score 100
Code Size 565 Byte
Status AC
Exec Time 4 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 6
Set Name Test Cases
All 00_sample.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt
Case Name Status Exec Time Memory
00_sample.txt AC 1 ms 256 KB
random_00.txt AC 4 ms 256 KB
random_01.txt AC 4 ms 256 KB
random_02.txt AC 3 ms 256 KB
random_03.txt AC 3 ms 256 KB
random_04.txt AC 4 ms 256 KB