#14066: 這哪裡錯了?


account404 (username)

學校 : 臺北市立建國高級中學
編號 : 68414
來源 : [114.24.110.28]
最後登入時間 :
2024-11-17 19:46:32

這哪裡錯了?

#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]
最後登入時間 :
2025-05-29 22:24:26

這哪裡錯了?

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

n <= 5000


用pow肯定overflow