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:晕~~~~~~以为是负的就不算呢

Posted by 810974380 at 2009-08-03 11:05:53 on Problem 2209
In Reply To:晕~~~~~~以为是负的就不算呢 Posted by:gxjloveyu at 2009-07-28 10:48:11
负的不用算!

#include<stdio.h>
int f(int n,int m)
{int w=1;
 while(m)
 {w*=n;
  m--;
 }
 return w;
}
int main()
{int n,x,y,i,a[100],s=0;
 scanf("%d",&n);
 scanf("%d",&x);
 for(i=0;i<n;i++)
 {scanf("%d",&a[i]);
  y=f(a[i],x);
  if(y>0) s+=y;
 }
 printf("%d",s);
 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