October 14, 2010

為啥第二組的比較簡單 哭哭

pi(高手級的答案 )

#include<iostream>
using namespace std;

int main()
{
    int a,i;
    double b;
    cout<<"Insert Ctrl+Z to exit.\n";
    
    while(cin>>a)
    {
        if(a<=0)break;
        b=0.0;
        for(i=0;i<=a;++i)
        {
            (i%2!=0) ? b-=(1/(2*double(i)+1)) : b+=(1/(2*double(i)+1));
        }
        cout<<b*4<<endl;
    }
    return 0;
}           
        
        
完全數 

#include <iostream>
using namespace std;

int main()

{
int a,b,c;
a=2;
while(a<10000)
{b=1;c=0;
 while(b<a)
  {if(a%b==0)
  {c=c+b;b++;}
  else
  {b++;}}
 if(a==c)
 {cout<<a<<endl;}
 a++;
}
return 0;
}

0推薦此文章
Today's Visitors: 0 Total Visitors: 18
Personal Category: Uncategorized Articles Topic: learning / academic / mathematics
[Trackback URL]

Reply
  • 1樓

    1樓搶頭香

    九卅娛樂城成為具備博奕產業跨平台整合能力之領導企業
    九卅娛樂城入主線上博奕產業的版圖
    而且您毋需再投入任何的建置成本。
    您只要擁有一份網路創業的熱誠,
    公司理念是協助、創造更多的利潤,
    也來自於您努力跟推廣,歡迎您的加入

    九卅娛樂城 http://ag536.ts777.net/
    QQ 2287432099
    電話 0981767742
    即時通 ts777.ts777@kimo.com 歡迎洽詢

  • at May 10, 2012 10:55 PM comment | Homepage
  • 2樓

    2樓頸推

    九卅娛樂城成為具備博奕產業跨平台整合能力之領導企業
    九卅娛樂城,
    亞洲最高賠率 0.975 最多紅利 100 1點
    另有多項娛樂 免費使用
    領錢不用等 30分鐘到帳 趕快加入

    記住電話 他會幫你實踐事業夢想
    九卅娛樂城 http://ag536.ts777.net/
    QQ 2287432099
    電話 0981767742
    即時通 ts777.ts777@kimo.com 歡迎洽詢

  • at May 10, 2012 10:59 PM comment | Homepage
  • 3樓

    3樓坐沙發

    伯勭唧

    這裏真不錯!!好文章!
    和順香業網拍事業部

    www.09169755278.com

    歡迎來參觀喔!

    偄剽

  • at June 19, 2012 06:40 PM comment
Post A Comment









Yes No



Please input the magic number:

( Prevent the annoy garbage messages )
( What if you cannot see the numbers? )
Please input the magic number

誰來收藏
Loading ...
unlog_NVPO 0