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> 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator