There is a chocolate vending machine.intially it contains a total of K chocolates N people are standing in a queue from left to rigth.Each person wants to withdraw chocolates.The i-i-th person wants to take Ai units of chocolates.People come in and try to withdraw chocolates one by one,in the increasing order of their indices.Whenever someone tries to withdraw chocolate,it will give them.Otherwise,it will throw an error and not give out anything in that case this person will return home directly without trying to do anything else for each person determine whether they will get the required amount of chocolate or not
input:The 1st line of input contains a single integer T denoting the no.of test cases the description of T test cases follows
the first line of each test case contais two separated integers N and K
the second line contains N space-separated integers A1,A2,A3----AN
INPUT:
2
5 10
3 5 3 2 1
4 6
10 8 6 4
OUTPUT:
11010
0010
INPUT:2
6 15
16 1 2 6 4 5
10 5
1 2 6 5 4 3 2 1 1 1
OUTPUT:
011110
1100001000
In rahul's school every student is uniquely identified by a string which is printed on the id card of the student .This unique id is comprised of letters and digits separated by hyphens into groups of different lengths.The college administration decides to standardize this unique id on the id card by regrouping the letters of the previous unique id to a fixed group length.the college administration also does not want to have lowercase letters in the new id.you need to help the college administration with this task.Given the previous id,and the no.of characters to group,you need to generate the new id
note:while generating the new unique id ,group the characters from right to left
input:the 1st line containing a string S representing a unique id.
the 2nd line containing an integer N representing group length
i/p:2-4A0r7-4k
3
o/p:24-A0R-74K
i/p:
5F3Z-2e-9-w
4
O/P:5F3Z-2E9W
Write a C++ program which takes multiple Employees information (records) as inputs from the
user and save them on a file using class. Writing in file should be done using setters. Perform
following operations on the data saved in the file:
• Read data from file
• Search an employee’s information in the file
• Count the number of employees having salary more than 50,000.
Write a C++ program which takes 5 students’ information (records) as inputs from the user and
save them on a file. Your program should have two options: writing and searching.
When a user selects writing option, you are required to take three inputs from the user: student
name (string type), student age (int type). After reading these data-items write to the file named “student.txt”. Please note: write data using append mode otherwise previous information will be lost.
Your program should have a search function. The search function should provide three options
for searching: by name, by age, or by registration number. After selection of the search option
by the user, please take input (name, age, or registration number) and search that student from the
file and display its record on the screen.
Write the correct title code that will do the following.
1) Ask the user to put the name of the nurtle screen.
2) Ask the user to input the background color of the turtle screen.
3) Ask the user to input a number that will instruct the turtle to move in accordance with number entered.
4) Ask the user to mput a number that will instruct the tunle to turn in accordance with the number
1. Write a C program that finds the smallest among the five integers inputted by the user.
2. The following program determines the proper fare of a passenger with the following data:
a.) Senior citizens and PWD enjoys 25%
b.) Students enjoys 15%
c.) Regular passengers have to pay the regular fare
write a program to print the given input word three times in a single line separated by spaces
Many companies use telephone numbers like 555-GET-FOOD so the number is easier
for their customers to remember. On a standard telephone, the alphabetic
letters are mapped to numbers in the following fashion:
A, B, C: 2
D, E, F: 3
G, H, I: 4
J, K, L: 5
M, N, O: 6
P, Q, R, S: 7
T, U, V: 8
W, X, Y, Z: 9
Write a program that asks the user to enter a 10-character telephone number in
the format XXX-XXX-XXXX. The application should display the telephone
number with any alphabetic characters that appeared in the original translated
to their numeric equivalent.
Write a program that reads a group of numbers from the user and places them in an array of type int. Once the numbers are stored in the array, the program should average them and print the result.
Given this list of students containing age and name, students = [{"age": 19, "name": "Eunice"}, {"age": 21, "name": "Agnes"}, {"age": 18, "name": "Teresa"}, {"age": 22, "name": "Asha"}], write a function that greets each student and tells them the year they were born. e.g Hello Eunice, you were born in the year 2002.