Follow Quotesrain
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • English APP
  • login
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • Walkins
    • Corporate Job Exam
    • Government Job Exam
    • Entrance Exam
  • Training
    • Internship
  • Placement Questions
  • /
  • Others
  • /
  • Programming
  • /
  • Basics

Others Programming - Basics Math Questions and Answer

Others Select Another Category Basics Select Another Topic

Maths Puzzle

  • A website 297
  • Book 23779
  • Campus 247
  • CMAT 49
  • Exam 86152
  • General 399
  • Interview 141
  • M4maths 294
  • Maths 226
  • Orkut 27
  • Other 72
  • Others 1356
  • Reasoning 101
  • Self 3157

Others Question Topics

    Category (34)

    General Ability (7)

  • General Knowledge (4)
  • HR Interview (11)

  • Interview (8)
  • Logical Reasoning (86)

  • Algebra (1)
  • Blood Relations (9)
  • Coding Decoding (6)
  • Cryptography (12)
  • Decision Making and Problem Solving (4)
  • Direction Sense (2)
  • General Mental Ability (10)
  • Letter Series (1)
  • Logical Sequences (2)
  • Mathematical Reasoning (7)
  • Missing Character (2)
  • Number Series (5)
  • Seating Arrangement (3)
  • Numerical Ability (218)

  • Age Problem (7)
  • Algebra (11)
  • Alligation or Mixture (3)
  • Area and Volume (5)
  • Arithmetic (6)
  • Averages (3)
  • Boats and Streams (1)
  • Clocks and Calendars (3)
  • Data Sufficiency (2)
  • Geometry (6)
  • Height and Distance (1)
  • Number System (19)
  • Percentage (6)
  • Permutation and Combination (16)
  • Probability (11)
  • Profit and Loss (5)
  • Quadratic Equations (5)
  • Ratio and Proportion (4)
  • Sequence and Series (4)
  • Simple & Compound Interest (5)
  • Time and Work (11)
  • Time Distance and Speed (3)
  • Trigonometry (1)
  • Programming (10)

  • Arrays (1)
  • Basics (1)
  • Program (5)
  • Puzzles (1)
  • Verbal Ability (5)

  • Antonyms (2)
  • Miscellaneous (1)
  • Sentence Completion (1)
Keep an EYE (0)
Solved Question (0) UnSolved Question (1)
Pages: 11
Advertisements

(#M40019807) OTHERS QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

Problem
In a holy village of India, there was a famous Guru. He had a number of followers from different countries. The day came when one of his favourite disciple Shiva was graduating. Filled with gratitude, and as is the ancient Indian custom, Shiva inquired about how he should pay his Guru Dakshina.(Tuition Fees)
The Guru was a wise man. He decided to teach Shiva one last lesson in the Art of Thinking Mathematically. He demanded his Dakshina (Fees) from Shiva in following manner
Guru wanted 100 gems distributed in 7 purses such that number of gems in 7 purses should always sum up to 100. But his condition was that he can demand any number of gems between 1 to 100 and Shiva must be able to satisfy his demand without needing to open any purse. Also once Shiva packs the purses, he will not get another chance to rearrange the number of Gems in those 7 purses. So consider that these purses are sealed the moment Shiva puts appropriate number of Gems in it.
Out of affection, the Guru decided to step up the difficulty level so that Shiva can survive the turbulent world outside the Gurukul. The Guru added one more condition that out of 7 purses Guru will always fill one purse with any number of gems. Thus Shiva need to distribute remaining Gems in rest of the 6 purses.

As,a new techie your task is to write a computer program to help Shiva in fulfilling his Guru's demand.


Input Format:
Input starts with the number of gems in a bag that follower have initially given by his master.
Line 1 N,where N is number of gems in one purse as conditioned by The Guru
Line 2 D, where D is number of gems demanded by The Guru from Shiva


Constraints:
0< N < =100
0 < D < =100
Output Format:
Print Distribution of gems in seven bags in ascending order,followed by the distribution of bags which will fulfill the demand of The Guru in ascending order
Line 1
For Valid Input,print
Distribution of gems in seven bags ordered in ascending,where quantity of gems in each bag is separated by space

For Invalid Input,print
Invalid Input
Line 2
For Valid Input,print
Distribution of bags in ascending order which will fulfill the demand of guru ,where quantity of gems in each bag is separated by space


Sample Test Cases:
SNo. Input Output Explanation
1
37
26
1 2 4 8 16 32 37
2 8 16
The Guru demands that one of the purses should contain 37 Gems. So Shiva packs them in 7 purses as mentioned in the output column.
The Guru now demands 26 Gems, Shiva knows that number of Gems in 3 purses add up to 26. So he gives purses containing 2, 8 and 16 to the Guru. Thus, he satisfies the condition that he does not have to shuffle his original packing.
2
J
25
Invalid Input J is not a number
3
33
150
Invalid Input 150 Gems out of 100 is not a valid demand
4
37
100
1 2 4 8 16 32 37
1 2 4 8 16 32 37
Guru demands 37 Gems be put in one bag and Guru demands a count of 100 Gems. Shiva hands over all 7 purses. Also note that any number between 1 and 100 is achievable using this combination. So Shiva has really satisfied his Guru.

Asked In Others bala (9 years ago)
Unsolved
Is this Puzzle helpful?   (10)   (13) Submit Your Solution Basics
Keep an EYE (0)
Solved Question (0) UnSolved Question (1)
Pages: 11
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

no image
Dimple
India
Punjab
Time: 00:01:33
Points
19

Maths Quotes

MATHEMATICS IS THE ONLY SUBJECT WHICH DEVELOPS OUR LOGICAL THINKING

pavanchandra

The only world in this universe is 'MATHEMATICS'.

Kiran B. Mali

Placed User Comments

M4Math helped me a lot.

Vipul Chavan 2 years ago

Thanks m4 maths for helping to get placed in several companies.
I must recommend this website for placement preparations.

yash mittal 3 years ago
  • 2471K+Registerd user
  • 1730K+Engineers
  • 741K+MBA Asprirant
  • 3K+Enginnering College
  • 250+Company Exam
  • 150K+Interview Questions
  • Site Links
  • Home
  • Result
  • Today's Puzzle
  • Discussion Board
  • Maths Tricks
  • Advertise with us
  • Contact Us
  • Useful Info
  • Maths Quotes
  • Previous Puzzles
  • Prize
  • Privacy Policy
  • Disclaimer and Copyright
  • Terms and Conditions
  • Sitemap
  • Placement papers
  • TCS Placement Paper
  • HCL Placement Paper
  • INFOSYS Placement Paper
  • IBM Placement Paper
  • SYNTEL Placement Paper
  • TECHNICAL Interview
  • HR Interview
All rights are reserved to @m4maths.com