Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:c语言AC了 但C++死活WA.主程序都是一句,有兴趣的来看看WHY??!!

Posted by Gamor at 2009-11-03 10:58:09 on Problem 2109
In Reply To:c语言AC了 但C++死活WA.主程序都是一句,有兴趣的来看看WHY??!! Posted by:20054959 at 2007-03-15 21:04:27
> C++:    //WA
> while(cin>>n>>p)
>     cout<<floor(pow(p,1.0/n))<<endl;      
> C:     //AC
> while(scanf("%lf%lf",&n,&p)==2)
> 	printf("%.0lf\n",pow(p,1.0/n));
> 就是把floor换成int或ceil都不能AC

典型的语言没过关。。。。printf里面不能有%lf,你随便去找找一本C语言参考书看看。但是某些编译器却可以通过printf里面的%lf...所以以后不要printf里面写%lf了

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator