谢谢!
------解决方案--------------------
照着写一个程序就行了.
------解决方案--------------------
- SQL code
declare @i intset @i=100while(@i<=999)begin if(@i=power((@i%10),3)+power((@i/10%10),3)+power((@i/100),3)) print @iset @[email protected]+1end/*153370371407*/
------解决方案--------------------
这是水仙花吧?
- SQL code
--- -- --- -- - -- - - - -- - - - -- - - - -- - - - - -- - - - -- - - -- - - -- - -- -- -- -- - - - - - - - - - - -select * from tb -
------解决方案--------------------
- SQL code
/*一个n位的数等于它的各位数的n次方之和 如153等于1的3次方加上5的3次方加上3的3次方等等 要求求所有2,3,4位的水仙花数*/declare @n int,@n1 int,@s intset @n=10while @n<9999begin set @[email protected] set @s=0 while @n1>0 begin set @[email protected]+power((@n1%10),(len(ltrim(@n)))) set @[email protected]/10 end if @[email protected] print @n set @[email protected]+1end/*153370371407163482089474*/