Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

The Begining Era Of Cyberverse CodeChef Solution

Problem – The Begining Era Of Cyberverse CodeChef Solution

2021 was approaching and the world was about to end. So 2 gods Saurabhx and Saurabhy (from Celesta) created the Cyberverse. But this time disappointed with humans both the gods decided not to have humans in this world. So they created a world of cyborgs. A world without humans. Isn’t it interesting? So let us dive into the cyberverse and have a look at their problems.

There are N kid cyborgs with Chief Cyborg ‘100gods’ and he has K weapons with him. He wants to distribute those K weapons among N kid cyborgs. Since all the kid cyborgs are very good friends, so they set a rule among themselves for taking those weapons. The rule states that the difference between kid cyborg having the maximum weapons and the kid cyborg having minimum weapons should be less than or equal to 1.
Find the value of the minimum number of weapons a kid cyborg can have when all the K weapons are distributed among them.

Input:

  • The first line contains an integer T, denoting the number of test cases.
  • Each of the next T lines will contain two space-separated integers denoting N and K respectively.

Output:

  • For each test case ,output a single line containing an integer X denoting the minimum number of weapons a kid cyborg can have in that test case.

Constraints:

  • 1≤T≤10^5
  • 1≤N≤10^5
  • 1≤K≤10^9

Sample 1:

Input:
1
5 8
Output:
1

Explanation:

  • There are 5 kids and 8 weapons.
  • Hence we will distribute the weapons such that 3 kids have 2 weapons each and the remaining 2 kids have 1 weapon each.
  • Hence the minimum number of weapons a kid cyborg has is 1. ( That is, min(1,2) = 1 )

The Begining Era Of Cyberverse CodeChef Solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
		    int n=sc.nextInt();
		    int k=sc.nextInt();
		    if(k>=n){
		    System.out.println(k/n);
		}else{
		    System.out.println(0);
		}
		}
	}
}

The Begining Era Of Cyberverse CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	int t,n,k;
	cin>>t;
	
	while(t--)
	{
	    cin>>n>>k;
	    int rem=k/n;
	    cout<<rem<<endl;
	   // if(rem==0)
	   //     cout<<1<<endl;
	   // else
	   //     cout<<rem<<endl;
	}
	return 0;
}

The Begining Era Of Cyberverse CodeChef Solution in Pyth 3

# cook your dish here
for i in range(int(input())):
    a,b=map(int,input().split())
    print(b//a)
The Begining Era Of Cyberverse CodeChef Solution Review:

In our experience, we suggest you solve this The Begining Era Of Cyberverse 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 The Begining Era Of Cyberverse CodeChef Solution

Find on CodeChef

Conclusion:

I hope this The Begining Era Of Cyberverse 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 Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

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