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 speedcell4 at 2011-07-21 10:28:09 on Problem 2209
#include<iostream>
using namespace std;
int n,e,a[101]={0};
int pow(int a,int b)
{
    if(b==0) return 1;
    else return a*pow(a,b-1);
}
int main()
{
    scanf("%d",&n);
    scanf("%d",&e);
    for(int i=0;n-i>0;i++) scanf("%d",&a[i]);
    int result=0,now;
    for(int i=0;n-i>0;i++)
    {
        now=pow(a[i],e);
        result+=now>0?now:0;
    }
    cout<<result<<endl;
   // system("pause");
    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