摘要:
水仙花数是指一个 n 位数 ( n≥3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如:1^3 + 5^3 + 3^3 = 153)初步代码: int nMax = 9999999; int nResult[9999]; int nCount = 0; for( int i = 0; i < nMax; i++ ) { if( i < 10 ) { if( i == i * i * i ) { nResult[nCount] = i; nCount++; } } else if( i < 100 ) { int nG = i % 10; int nS = i / 1 阅读全文
posted @ 2011-07-23 14:46
jqb
阅读(846)
评论(0)
推荐(0)

浙公网安备 33010602011771号