Submission #3168331


Source Code Expand

#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <fstream>
#include <sstream>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;


int main(){

  int T,N,D;
  cin>>T;
  rep(roop,T){
    cin>>N>>D;
    if(N==1){cout<<D<<endl;continue;}

    N--;
    if(N%2==0)cout<<N*127+D<<endl;
    else cout<<N*127+127-D<<endl;


  }



}

Submission Info

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