Submission #1820265


Source Code Expand

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

long q,a,n,d,kq;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>q;
	while(q--){
		cin>>n>>d;
		a=d^127;
		if(n%2==0) kq=a+(n-1)*127;
		else if(n%2==1) kq=2*127+d+(n-3)*127;
		if(n==1) kq=d;
		cout<<kq<<endl;
	}
}

Submission Info

Submission Time
Task C - Cookie Breeding Machine
User vjudge3
Language C++14 (GCC 5.4.1)
Score 100
Code Size 300 Byte
Status AC
Exec Time 1 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 1 ms 256 KB
random_01.txt AC 1 ms 256 KB
random_02.txt AC 1 ms 256 KB
random_03.txt AC 1 ms 256 KB
random_04.txt AC 1 ms 256 KB