Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
找了找好象这算比较短的代码了#include <iostream> #include <cmath> using namespace std; int main() { int n,i,s,c=0; double t,p; cin>>n>>p; for(i=0;i<n;i++) cin>>t,s=(int)pow(t,p),c+=(s>0?s:0); cout<<c; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator