#9599: 第二測資


stan30414 (黃穆)


第 2 測資點(0%): WA (line:21) 
答案不正確
您的答案為: 2^20 = 1.04858e+06 正確答案為: 2^20 = 1048576
是我的程式問題嘛?
#include <iostream> #include <math.h> using namespace std; int main(){ float x; while(cin>>x){ for(int i=0;i<=x;i++){ cout <<"2^"<<i<<" = "<<pow(2,i) << endl ; } } return 0; }    
這樣子有錯嘛??    被NA了     有誰能告訴我問題在哪裡
#9656: Re:第二測資


onion_d (新帳號是炭烤海苔呦~話說我的校內排名被擠到第四頁了學妹超棒d...)


第 2 測資點(0%): WA (line:21) 
答案不正確
您的答案為: 2^20 = 1.04858e+06 正確答案為: 2^20 = 1048576
是我的程式問題嘛?
#include #include using namespace std; int main(){ float x; while(cin>>x){ for(int i=0;i<=x;i++){ cout <<"2^"<    
這樣子有錯嘛??    被NA了     有誰能告訴我問題在哪裡

 

@@我也是

 

注意!! pow(a,b) 的輸出值為double

被NA好嘔 

#41306: Re: 第二測資


rrtt0817@gmail.com (414440817 李誌豪)


第 2 測資點(0%): WA (line:21) 
答案不正確
您的答案為: 2^20 = 1.04858e+06 正確答案為: 2^20 = 1048576
是我的程式問題嘛?
#include #include using namespace std; int main(){ float x; while(cin>>x){ for(int i=0;i<=x;i++){ cout <<"2^"<    
這樣子有錯嘛??    被NA了     有誰能告訴我問題在哪裡

 

@@我也是

 

注意!! pow(a,b) 的輸出值為double

用強制轉型(long long)

被NA好嘔