Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Puppy and Board CodeChef Solution

Problem -Puppy and Board CodeChef Solution

This website is dedicated for CodeChef solution where we will publish right solution of all your favourite CodeChef problems along with detailed explanatory of different competitive programming concepts and languages.

Puppy and Board CodeChef Solution in C++14

#include <iostream>
using namespace std;


void solve() {
  int n, m; cin >> n >> m ;
  --n, --m;
  if (n%4==m%3) {
    cout << "Vanya" << endl;
  }
  else {
      cout << "Tuzik" << endl;
  }
}

int main() {
  // freopen("input.txt", "r", stdin);
  ios_base::sync_with_stdio(false); cin.tie(0);
  int t; cin >> t ;
  while (t--) solve() ;
  return 0;
}

Puppy and Board CodeChef Solution in PYTH 3


t = int(input())

for i in range(t):
    r, c = map(int, input().split())
    if (c - 1) % 3 == 0 and (r - 1) % 4 == 0: 
        print('Vanya')
    elif (c - 1) % 3 != 0 and (r - 1) % 4 == 0: 
        print('Tuzik')
    elif (c - 1) % 3 == 0 and (r - 1) % 4 != 0: 
        print('Tuzik')
    else:
        if (c - 1) % 3 == 1 and (r - 1) % 4 == 1: 
            print('Vanya')
        elif (c - 1) % 3 == 2 and (r - 1) % 4 == 2: 
            print('Vanya')
        else: 
            print('Tuzik')

Puppy and Board CodeChef Solution in C

#include <stdio.h>
 
int main(){
        int t,n,m;
        scanf("%d", &t);
        while(t--){
                scanf("%d %d",&n,&m);
                if(((n-1)%4) != ((m-1)%3)){
                        printf("Tuzik\n");
                }
                else{
                        printf("Vanya\n");
                }
        }
}
 

Puppy and Board CodeChef Solution in JAVA

//created by Whiplash99
import java.io.*;
import java.util.*;
class B
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N;

        int T=Integer.parseInt(br.readLine().trim());
        StringBuilder sb=new StringBuilder();
        String A="Tuzik", B="Vanya";

        while(T-->0)
        {
            String s[]=br.readLine().trim().split(" ");
            N=Integer.parseInt(s[0]);
            int M=Integer.parseInt(s[1]);

            N--; M--;
            int X=N%4, Y=M%3;
            if(X==0&&Y==0) sb.append(B);
            else if(X==0||Y==0) sb.append(A);
            else
            {
                if(X==1&&Y==1) sb.append(B);
                else if(X==1||Y==1) sb.append(A);
                else if(X==2) sb.append(B);
                else sb.append(A);
            }
            sb.append("\n");
        }
        System.out.println(sb);
    }
}

Puppy and Board CodeChef Solution in PYPY 3

t = int(input())
for _ in range(t):
    n, m = map(int, input().split())
    if ((n - 1) % 4) ^ ((m - 1) % 3):
        print('Tuzik')
    else:
        print('Vanya')

Puppy and Board CodeChef Solution in PYTH

# cook your code here
t=input()
for tc in range(0, t):
	n,m=map(int,raw_input().split())
	if (m-1)%3 ^ (n-1)%4 > 0:
		print("Tuzik") 
	else:
		print("Vanya") 

Puppy and Board CodeChef Solution in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeChefGamePuppy
{
    class Program
    {
        static void Main(string[] args)
        {
            int T = int.Parse(Console.ReadLine());
            for (int j = 0; j < T; j++)
            {
                string s = Console.ReadLine();
               // string s = "2 3";
                string[] aa = s.Split(' ');

                int N = int.Parse(aa[0]);
                int M = int.Parse(aa[1]);
                N = N - 1;
                M = (M - 1) % 3;
                N = (N - M) % 4;
                if(N==0)
                {
                    Console.WriteLine("Vanya");
                }
                else
                {
                    Console.WriteLine("Tuzik");
                }
                /*
                if ((N - 1) % 4 == 0 ^ (M - 1) % 3 == 0)
                {
                    Console.WriteLine("Tuzik");
                }

                else
                {
                    if (N == 2 && M == 3)
                    {
                        Console.WriteLine("Tuzik");
                    }
                    else if (N == 3 && M == 2)
                    {
                        Console.WriteLine("Tuzik");
                    }
                    else
                    {
                        Console.WriteLine("Vanya");
                    }
                }
                */
            }
        }
    }
}

Puppy and Board CodeChef Solution in GO

package main
import "fmt"

func main(){
	var t int
	fmt.Scanf("%d",&t)
	for iter:=0;iter<t;iter++ {
		var n,m int
		fmt.Scanf("%d %d",&n,&m)
		ans:= 0
		n = n%4
		m = m%3
		if n==1&&m==1 {
			ans = 1
		}
		if n==2&&m==2 {
			ans = 1
		}
		if n==3&&m==0 {
			ans = 1
		}
		if ans == 1 {
			fmt.Println("Vanya")
		}else{
			fmt.Println("Tuzik")
		}
	}
}
Puppy and Board CodeChef Solution Review:

In our experience, we suggest you solve this Puppy and Board CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Puppy and Board CodeChef Solution.

Find on CodeChef

Conclusion:

I hope this Puppy and Board CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

Cognitive Class Answer

CodeChef Solution

Microsoft Learn

Leave a Reply

Your email address will not be published. Required fields are marked *