#14066: 這哪裡錯了?


account404 (username)

學校 : 臺北市立建國高級中學
編號 : 68414
來源 : [114.24.92.90]
最後登入時間 :
2024-01-06 20:48:23
d817. Pascal's triangle's secret (I) | From: [1.162.200.144] | 發表日期 : 2018-06-07 22:46

這哪裡錯了?

#include <iostream>
#include <math.h>
using namespace ::std;
int main(){
int n;
while(cin>>n){
cout<<pow(2,n)<<endl;
}
return 0;
}

 
#14067: Re:這哪裡錯了?


anandrewboy70900 (ShowTsai)

學校 : 國立中央大學
編號 : 27736
來源 : [203.204.218.144]
最後登入時間 :
2024-02-07 22:53:10
d817. Pascal's triangle's secret (I) | From: [140.115.204.235] | 發表日期 : 2018-06-08 02:26

這哪裡錯了?

#include
#include
using namespace ::std;
int main(){
int n;
while(cin>>n){
cout<<pow(2,n)<<endl;
}
return 0;
}

n <= 5000


用pow肯定overflow

 
ZeroJudge Forum