With 1 points, 5 points, 10 points, 25 points, 50 cents coins into one yuan, a total of several combinations of methods? (SQL Puzzles)

Source: Internet
Author: User
Tags rtrim

As early as itpub saw a SQL expert, like the puzzle, the following is a puzzle. I tried SQL Server to resolve this issue.

With 1 points,5 points , 10 points , 25 points , 50 cents coins into one yuan, a total of several combinations of methods?

SELECT'1*'+RTrim(A. Number)+'+5*'+RTrim(b. Number)+'+10*'+RTrim(c. Number)+'+25*'+RTrim(d. Number)+'+50*'+RTrim(E. Number) asresult from(Select  Number  fromMaster.dbo.spt_valueswhereType='P' and  Number<= -) A, (Select  Number  fromMaster.dbo.spt_valueswhereType='P' and  Number<= -) b, (Select  Number  fromMaster.dbo.spt_valueswhereType='P' and  Number<=Ten) C, (Select  Number  fromMaster.dbo.spt_valueswhereType='P' and  Number<=4) d, (Select  Number  fromMaster.dbo.spt_valueswhereType='P' and  Number<=2) eWHERE 1*A. Number+5*B. Number+Ten*C. Number+ -*D. Number+ -*E. Number= -;

Results:

1*100+5*0+10*0+25*0+50*01*95+5*1+10*0+25*0+50*01*90+5*2+10*0+25*0+50*01*85+5*3+10*0+25*0+50*01*80+5*4+10*0+25* 0+50*01*75+5*5+10*0+25*0+50*01*70+5*6+10*0+25*0+50*01*65+5*7+10*0+25*0+50*01*60+5*8+10*0+25*0+50*01*55+5*9+10* 0+25*0+50*01*50+5*10+10*0+25*0+50*01*45+5*11+10*0+25*0+50*01*40+5*12+10*0+25*0+50*01*35+5*13+10*0+25*0+50*01* 30+5*14+10*0+25*0+50*01*25+5*15+10*0+25*0+50*01*20+5*16+10*0+25*0+50*01*15+5*17+10*0+25*0+50*01*10+5*18+10*0+ 25*0+50*01*5+5*19+10*0+25*0+50*01*0+5*20+10*0+25*0+50*01*90+5*0+10*1+25*0+50*01*85+5*1+10*1+25*0+50*01*80+5*2+ 10*1+25*0+50*01*75+5*3+10*1+25*0+50*01*70+5*4+10*1+25*0+50*01*65+5*5+10*1+25*0+50*01*60+5*6+10*1+25*0+50*01*55 +5*7+10*1+25*0+50*01*50+5*8+10*1+25*0+50*01*45+5*9+10*1+25*0+50*01*40+5*10+10*1+25*0+50*01*35+5*11+10*1+25*0+ 50*01*30+5*12+10*1+25*0+50*01*25+5*13+10*1+25*0+50*01*20+5*14+10*1+25*0+50*01*15+5*15+10*1+25*0+50*01*10+5*16+ 10*1+25*0+50*01*5+5*17+10*1+25*0+50*01*0+5*18+10*1+25*0+50*01*80+5*0+10*2+25*0+50*01*75+5*1+10*2+25*0+50*01*70 +5*2+10*2+25*0+50*01*65+5*3+10*2+25*0+50*01*60+5*4+10*2+25*0+50*01*55+5*5+10*2+25*0+50*01*50+5*6+10*2+25*0+50*01*45+5*7+10* 2+25*0+50*01*40+5*8+10*2+25*0+50*01*35+5*9+10*2+25*0+50*01*30+5*10+10*2+25*0+50*01*25+5*11+10*2+25*0+50*01*20+ 5*12+10*2+25*0+50*01*15+5*13+10*2+25*0+50*01*10+5*14+10*2+25*0+50*01*5+5*15+10*2+25*0+50*01*0+5*16+10*2+25*0+ 50*01*70+5*0+10*3+25*0+50*01*65+5*1+10*3+25*0+50*01*60+5*2+10*3+25*0+50*01*55+5*3+10*3+25*0+50*01*50+5*4+10*3+ 25*0+50*01*45+5*5+10*3+25*0+50*01*40+5*6+10*3+25*0+50*01*35+5*7+10*3+25*0+50*01*30+5*8+10*3+25*0+50*01*25+5*9+ 10*3+25*0+50*01*20+5*10+10*3+25*0+50*01*15+5*11+10*3+25*0+50*01*10+5*12+10*3+25*0+50*01*5+5*13+10*3+25*0+50*01 *0+5*14+10*3+25*0+50*01*60+5*0+10*4+25*0+50*01*55+5*1+10*4+25*0+50*01*50+5*2+10*4+25*0+50*01*45+5*3+10*4+25*0+ 50*01*40+5*4+10*4+25*0+50*01*35+5*5+10*4+25*0+50*01*30+5*6+10*4+25*0+50*01*25+5*7+10*4+25*0+50*01*20+5*8+10*4+ 25*0+50*01*15+5*9+10*4+25*0+50*01*10+5*10+10*4+25*0+50*01*5+5*11+10*4+25*0+50*01*0+5*12+10*4+25*0+50*01*50+5*0 +10*5+25*0+50*01*45+5*1+10*5+25*0+50*01*40+5*2+10*5+25*0+50*01*35+5*3+10*5+25*0+50*01*30+5*4+10*5+25*0+50*01*25+5*5+10*5+ 25*0+50*01*20+5*6+10*5+25*0+50*01*15+5*7+10*5+25*0+50*01*10+5*8+10*5+25*0+50*01*5+5*9+10*5+25*0+50*01*0+5*10+ 10*5+25*0+50*01*40+5*0+10*6+25*0+50*01*35+5*1+10*6+25*0+50*01*30+5*2+10*6+25*0+50*01*25+5*3+10*6+25*0+50*01*20 +5*4+10*6+25*0+50*01*15+5*5+10*6+25*0+50*01*10+5*6+10*6+25*0+50*01*5+5*7+10*6+25*0+50*01*0+5*8+10*6+25*0+50*01 *30+5*0+10*7+25*0+50*01*25+5*1+10*7+25*0+50*01*20+5*2+10*7+25*0+50*01*15+5*3+10*7+25*0+50*01*10+5*4+10*7+25*0+ 50*01*5+5*5+10*7+25*0+50*01*0+5*6+10*7+25*0+50*01*20+5*0+10*8+25*0+50*01*15+5*1+10*8+25*0+50*01*10+5*2+10*8+25 *0+50*01*5+5*3+10*8+25*0+50*01*0+5*4+10*8+25*0+50*01*10+5*0+10*9+25*0+50*01*5+5*1+10*9+25*0+50*01*0+5*2+10*9+ 25*0+50*01*0+5*0+10*10+25*0+50*01*75+5*0+10*0+25*1+50*01*70+5*1+10*0+25*1+50*01*65+5*2+10*0+25*1+50*01*60+5*3+ 10*0+25*1+50*01*55+5*4+10*0+25*1+50*01*50+5*5+10*0+25*1+50*01*45+5*6+10*0+25*1+50*01*40+5*7+10*0+25*1+50*01*35 +5*8+10*0+25*1+50*01*30+5*9+10*0+25*1+50*01*25+5*10+10*0+25*1+50*01*20+5*11+10*0+25*1+50*01*15+5*12+10*0+25*1+50*01*10+5* 13+10*0+25*1+50*01*5+5*14+10*0+25*1+50*01*0+5*15+10*0+25*1+50*01*65+5*0+10*1+25*1+50*01*60+5*1+10*1+25*1+50*01 *55+5*2+10*1+25*1+50*01*50+5*3+10*1+25*1+50*01*45+5*4+10*1+25*1+50*01*40+5*5+10*1+25*1+50*01*35+5*6+10*1+25*1+ 50*01*30+5*7+10*1+25*1+50*01*25+5*8+10*1+25*1+50*01*20+5*9+10*1+25*1+50*01*15+5*10+10*1+25*1+50*01*10+5*11+10* 1+25*1+50*01*5+5*12+10*1+25*1+50*01*0+5*13+10*1+25*1+50*01*55+5*0+10*2+25*1+50*01*50+5*1+10*2+25*1+50*01*45+5* 2+10*2+25*1+50*01*40+5*3+10*2+25*1+50*01*35+5*4+10*2+25*1+50*01*30+5*5+10*2+25*1+50*01*25+5*6+10*2+25*1+50*01* 20+5*7+10*2+25*1+50*01*15+5*8+10*2+25*1+50*01*10+5*9+10*2+25*1+50*01*5+5*10+10*2+25*1+50*01*0+5*11+10*2+25*1+ 50*01*45+5*0+10*3+25*1+50*01*40+5*1+10*3+25*1+50*01*35+5*2+10*3+25*1+50*01*30+5*3+10*3+25*1+50*01*25+5*4+10*3+ 25*1+50*01*20+5*5+10*3+25*1+50*01*15+5*6+10*3+25*1+50*01*10+5*7+10*3+25*1+50*01*5+5*8+10*3+25*1+50*01*0+5*9+10 *3+25*1+50*01*35+5*0+10*4+25*1+50*01*30+5*1+10*4+25*1+50*01*25+5*2+10*4+25*1+50*01*20+5*3+10*4+25*1+50*01*15+5*4+10*4+25*1 +50*01*10+5*5+10*4+25*1+50*01*5+5*6+10*4+25*1+50*01*0+5*7+10*4+25*1+50*01*25+5*0+10*5+25*1+50*01*20+5*1+10*5+ 25*1+50*01*15+5*2+10*5+25*1+50*01*10+5*3+10*5+25*1+50*01*5+5*4+10*5+25*1+50*01*0+5*5+10*5+25*1+50*01*15+5*0+10 *6+25*1+50*01*10+5*1+10*6+25*1+50*01*5+5*2+10*6+25*1+50*01*0+5*3+10*6+25*1+50*01*5+5*0+10*7+25*1+50*01*0+5*1+ 10*7+25*1+50*01*50+5*0+10*0+25*2+50*01*45+5*1+10*0+25*2+50*01*40+5*2+10*0+25*2+50*01*35+5*3+10*0+25*2+50*01*30 +5*4+10*0+25*2+50*01*25+5*5+10*0+25*2+50*01*20+5*6+10*0+25*2+50*01*15+5*7+10*0+25*2+50*01*10+5*8+10*0+25*2+50* 01*5+5*9+10*0+25*2+50*01*0+5*10+10*0+25*2+50*01*40+5*0+10*1+25*2+50*01*35+5*1+10*1+25*2+50*01*30+5*2+10*1+25*2 +50*01*25+5*3+10*1+25*2+50*01*20+5*4+10*1+25*2+50*01*15+5*5+10*1+25*2+50*01*10+5*6+10*1+25*2+50*01*5+5*7+10*1+ 25*2+50*01*0+5*8+10*1+25*2+50*01*30+5*0+10*2+25*2+50*01*25+5*1+10*2+25*2+50*01*20+5*2+10*2+25*2+50*01*15+5*3+ 10*2+25*2+50*01*10+5*4+10*2+25*2+50*01*5+5*5+10*2+25*2+50*01*0+5*6+10*2+25*2+50*01*20+5*0+10*3+25*2+50*01*15+5*1+10*3+25*2+ 50*01*10+5*2+10*3+25*2+50*01*5+5*3+10*3+25*2+50*01*0+5*4+10*3+25*2+50*01*10+5*0+10*4+25*2+50*01*5+5*1+10*4+25* 2+50*01*0+5*2+10*4+25*2+50*01*0+5*0+10*5+25*2+50*01*25+5*0+10*0+25*3+50*01*20+5*1+10*0+25*3+50*01*15+5*2+10*0+ 25*3+50*01*10+5*3+10*0+25*3+50*01*5+5*4+10*0+25*3+50*01*0+5*5+10*0+25*3+50*01*15+5*0+10*1+25*3+50*01*10+5*1+10 *1+25*3+50*01*5+5*2+10*1+25*3+50*01*0+5*3+10*1+25*3+50*01*5+5*0+10*2+25*3+50*01*0+5*1+10*2+25*3+50*01*0+5*0+10 *0+25*4+50*01*50+5*0+10*0+25*0+50*11*45+5*1+10*0+25*0+50*11*40+5*2+10*0+25*0+50*11*35+5*3+10*0+25*0+50*11*30+5 *4+10*0+25*0+50*11*25+5*5+10*0+25*0+50*11*20+5*6+10*0+25*0+50*11*15+5*7+10*0+25*0+50*11*10+5*8+10*0+25*0+50*11 *5+5*9+10*0+25*0+50*11*0+5*10+10*0+25*0+50*11*40+5*0+10*1+25*0+50*11*35+5*1+10*1+25*0+50*11*30+5*2+10*1+25*0+ 50*11*25+5*3+10*1+25*0+50*11*20+5*4+10*1+25*0+50*11*15+5*5+10*1+25*0+50*11*10+5*6+10*1+25*0+50*11*5+5*7+10*1+ 25*0+50*11*0+5*8+10*1+25*0+50*11*30+5*0+10*2+25*0+50*11*25+5*1+10*2+25*0+50*11*20+5*2+10*2+25*0+50*11*15+5*3+10*2+25*0+50* 11*10+5*4+10*2+25*0+50*11*5+5*5+10*2+25*0+50*11*0+5*6+10*2+25*0+50*11*20+5*0+10*3+25*0+50*11*15+5*1+10*3+25*0+ 50*11*10+5*2+10*3+25*0+50*11*5+5*3+10*3+25*0+50*11*0+5*4+10*3+25*0+50*11*10+5*0+10*4+25*0+50*11*5+5*1+10*4+25* 0+50*11*0+5*2+10*4+25*0+50*11*0+5*0+10*5+25*0+50*11*25+5*0+10*0+25*1+50*11*20+5*1+10*0+25*1+50*11*15+5*2+10*0+ 25*1+50*11*10+5*3+10*0+25*1+50*11*5+5*4+10*0+25*1+50*11*0+5*5+10*0+25*1+50*11*15+5*0+10*1+25*1+50*11*10+5*1+10 *1+25*1+50*11*5+5*2+10*1+25*1+50*11*0+5*3+10*1+25*1+50*11*5+5*0+10*2+25*1+50*11*0+5*1+10*2+25*1+50*11*0+5*0+10 *0+25*2+50*11*0+5*0+10*0+25*0+50*2

  

With 1 points, 5 points, 10 points, 25 points, 50 cents coins into one yuan, a total of several combinations of methods? (SQL Puzzles)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.