d A professor is teaching a class that has a students that are numbered 1.2...... The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
d A professor is teaching a class that has a students that are numbered 1.2...... The professor started noticing a pattern in how students attend the class. Assuming 0 indicates a student is absent and 1 indicates a student is present, the students come to class everyday in the following patterns: The first student's pattern is 1010101010101010.... • The second student's pattern is 1100110011001100 The third student's pattern is 111000111000111000. The fourth student's pattern is 1111000011110000 • The fifth student's pattern is 11111000001111100000. and so on. Given a number of students and a day d. your task is to determine the number of present students? Program Input: A single line that contains two integers n and d, the number of students and the specified day, Program Output: A single line contains how many students will be present at day d Sample Testcase 0: Input: 4:10 All students will be present on the first day. CodeBox 1 import java.util.Scanner; 2 3 public class Solution t SU public static void main(String[] args) { Scanner scanner new Scanner (System.in); int n scanner.nextInt(); int d scanner.nextInt (); / your code starts here your code ends here scanner.close(); All students will be present on the first day. CodeBox 1 import java.util.Scanner; 3 public class Solution ( public static void main(String[] args) { Scanner scanner new Scanner(System. Tn): int n scanner.nextInt(); tht d scanner.nextInt(): Y your code starts here / Yr your code ends here w scanner.close(); d A professor is teaching a class that has a students that are numbered 1.2...... The professor started noticing a pattern in how students attend the class. Assuming 0 indicates a student is absent and 1 indicates a student is present, the students come to class everyday in the following patterns: The first student's pattern is 1010101010101010.... • The second student's pattern is 1100110011001100 The third student's pattern is 111000111000111000. The fourth student's pattern is 1111000011110000 • The fifth student's pattern is 11111000001111100000. and so on. Given a number of students and a day d. your task is to determine the number of present students? Program Input: A single line that contains two integers n and d, the number of students and the specified day, Program Output: A single line contains how many students will be present at day d Sample Testcase 0: Input: 4:10 All students will be present on the first day. CodeBox 1 import java.util.Scanner; 2 3 public class Solution t SU public static void main(String[] args) { Scanner scanner new Scanner (System.in); int n scanner.nextInt(); int d scanner.nextInt (); / your code starts here your code ends here scanner.close(); All students will be present on the first day. CodeBox 1 import java.util.Scanner; 3 public class Solution ( public static void main(String[] args) { Scanner scanner new Scanner(System. Tn): int n scanner.nextInt(); tht d scanner.nextInt(): Y your code starts here / Yr your code ends here w scanner.close();
Expert Answer:
Related Book For
Posted Date:
Students also viewed these computer engineering questions
-
In January 2010 the Status Quo Company was formed. Total assets were $500,000, of which $300,000 consisted of capital assets. Status Quo uses straight-line amortization, and in 2010 it estimated its...
-
If a charged particle moves in a straight line through some region of space, can you say that the magnetic field in that region is zero?
-
If a charged particle moves in a straight line and there are no other forces on it except possibly from a magnetic field, can you say with certainty that no magnetic field is present? Explain.
-
Q3: Prove: For any sets A and B, Ax B = B A ?
-
Suppose that you have two different X variables (X 1 , X 2 ) that you use to predict scores on Y. What formula would you need to use to assess whether their correlations with Y differ significantly?...
-
(L05) Susan owns a floral shop as a sole proprietorship and has net earnings of \(\( \$ \) 100,000\) on Schedule C. Susan is allowed a selfemployment tax deduction for AGI of \( \$ \)7,065 \((\( \$...
-
Picture Gallery, Inc. works weddings and prom-type parties. The balance of retained earnings was \($18,000\) at December 31, 2010. At December 31, 2011, the businesss accounting records show these...
-
The manager of a commuter rail transportation system was recently asked by her governing board to determine which factors have a significant impact on the demand for rides in the large city served by...
-
the Alexis Company for the month of November 2019: Job No. 123 Job No. 124 Job No. 125 Job No. 126 Job No. 127 In process, Nov. 1 Materials P20,000 P30,000 P90,000 0 Labor P70,000 P40.000 P100,000 0...
-
Given the following information, answer the following questions referencing the floor plan for a corporate training facility and the associated table and psychrometric chart. Building exhaust is 1100...
-
Discuss the ideas that are essential while designing an organization
-
How easy is it for technical entrepreneurs to set up firms in your local area? What forms of assistance are available to help them? What types of infrastructure, support and finance are provided by...
-
What are the influential variables in the capital structure decision of businesses? Do they differ according to the size of the business (i.e., whether it is small or large)?
-
Which areas within your country have the greatest concentrations of technology-based firms? Why do you think that such firms are so common there and what resource or factor advantages exist?
-
Small businesses invariably have higher gearing levels than large businesses. Discuss.
-
Select a technology-based business and develop a short case study profile of the firm and its founder (or principal founder in the case of a team-based start-up). How and in which areas of the firm...
-
Discuss with your classmates how you designed your device. Be sure to explain how you met the design constraints and any modifications that you made to your original design. Include pictures and/or...
-
Draw two scatterplots, one for which r = 1 and a second for which r = 21.
-
The flux through a loop of wire changes uniformly from + 40Wb to 20Wb in 1.5ms. (a) What is the significance of the negative number attached to the final flux value? (b) What is the average induced...
-
(a) What is the absolute pressure at a depth of 10 m in a lake? (b) What is the gauge pressure?
-
An alcohol rub can rapidly decrease body (skin) temperature. (a) This is because of (1) the cooler temperature of the alcohol, (2) the evaporation of alcohol, (3) the high specific heat of the human...
-
Name four disruptive business models and describe what they offer to their customers.
-
How is IT contributing to the success of the on-demand and shared economies?
-
What are the key strategic and tactical questions that determine an organizations profitability and management performance?
Study smarter with the SolutionInn App