¹C«È:  µù¥U | µn¿ý | ·j¯Á | À°§U | VIPÃÙ§U¥»¯¸ | ¥ZµnÃÙ§U¼s§i | ³]¬°­º­¶ | ¥[¤J¦¬Âà | ÁcÅ餤¤å

 

your gf Ú»­ø¨ì¤ù ¥î¼äóa ¤£¯à³X°ÝSOPCAST­¶­± ¶Â¦â­I´º ¤ÑÀs¤K³¡·tª÷Ä_ ¸Ý¥Ponline©xºô ¤p¤t¬ü ½u¤WH°Êµe §K¶O§Y®É³ø»ù ªá¼Ë¤Ö¦~¤Ö¤k¢ê¢ü ¤Ó»×¥ß§Ó¶Ç ¤H¶¡¤¿¾¹º©µe Hebe·s¾v«¬ Media calssic I miss you³¯¬f¦t seed H LostPlanet¯}¸Ñ ¤Ñ°ó¨pªA³Ü¤ôµ{¦¡ ¤Ñ¥~2 online ¯]®ü®á®³¤p©j¥þ®M

 




·j¯Á¿ï¶µ ¯Á¤Þ¨t²Î¤u¨ãµ¡
 
¼ÐÃD: ¨D±Ï.....Ãö©óvb.net¬JConsoleApplication......
http://manyway.net ÃÙ§Uºô¯¸¸ü¤J¤¤...
ssp
¤j²³¥¿¦¡·|­û
Rank: 2Rank: 2


ºaÅA¾±³¹ ¥Ø«e¨S¦³¾±³¹

UID¡G 527737

©Ê§O¡G «O±K

ºëµØ¡G 0 ½g

¿n¤À¡G 104 ÂI

©«¤l¡G 22 ½g

  ¤j ¤¤ ¤p
µoªí©ó 2006-12-2 23:10  ¸ê®Æ  ­Ó¤HªÅ¶¡  µu®ø®§  ¥[¬°¦n¤Í 

¨D±Ï.....Ãö©óvb.net¬JConsoleApplication...... ±z¬O²Ä 294­ÓÂsÄýªÌ

An Integer number is said to be a prefect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3

Factor of 6 is 1, 2, 3, (6 not include)

Write a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect.

(Hint: Only have 3 numbers is perfect number between 1 and 1000)
e­Ó¬Jµ{¦¡ÂI¼g..~.~.......

³»³¡
jayzhou_2046
¤j²³¥¿¦¡·|­û
Rank: 2Rank: 2


ºaÅA¾±³¹ ¥Ø«e¨S¦³¾±³¹

UID¡G 788993

©Ê§O¡G «O±K

ºëµØ¡G 0 ½g

¿n¤À¡G 100 ÂI

©«¤l¡G 2 ½g

  ¤j ¤¤ ¤p
µoªí©ó 2006-12-6 16:15  ¸ê®Æ  ­Ó¤HªÅ¶¡  µu®ø®§  ¥[¬°¦n¤Í 
¦^´_ #1 ssp ªº©«¤l

¤âÀY¤WÉNvb/vb.net,
¥Î¦íc++¸Õª±¤@¤U,
§Æ±æ¥i¥H­Ú¨ìoªºidea§A:

QUOTE:
#include <iostream>
#include <list>
#include <algorithm>

using namespace std;

int isPrime(int inNum) {
        int retval = 1;
       
        for (int i = 2; i < inNum; i++) {
                if (inNum % i == 0)
                        retval = 0;
        }
        return retval;
}

int findFactor(int inNum) {
        int retval = 0;
        list<int> thisList;
        list<int>::iterator thisIter;
        int sum = 0;
       
        for (int i = 1; i < inNum; i++) {
                if (inNum % i == 0) {
                        //cout << i << " ";
                        thisList.push_back(i);
                }
        }
       
        thisIter = thisList.begin();
        while (thisIter != thisList.end()) {
                sum += (int) *thisIter;
                thisIter++;
        }

        if (sum == inNum)
                retval = 1;
        return retval;
}

void main() {
        for (int i = 1; i < 1000; i++) {
                if (findFactor(i)) {
                        cout << i << " ";
                }
        }
        cout << endl;
}


³»³¡

 



¥»¯¸³]³Æ¾¹§÷¥Ñ Many Way (HK) Limited ÃÙ§U´£¨Ñ
·í«e®É°Ï GMT+8, ²{¦b®É¶¡¬O 2008-9-7 22:07

Advertisting Agency

Audit and Analytics

Partner Companies

Powered by Discuz! 5.5.0¢x0.049848 (s), 7 queries, Copyright © 2008 HK-PUB.COM All Rights Reserved. ¥»¯¸Án©ú - ¼s§i¬d¸ß - ²M°£ Cookies - Ápô§Ú­Ì - ¤j²³½×¾Â - Archiver - WAP