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

找了找好象这算比较短的代码了

Posted by chinaboard at 2010-07-27 10:23:53 on Problem 2209
#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:
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