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:sort函数我是不是用错了?

Posted by jimmyzzxhlh at 2005-03-20 10:58:13 on Problem 2209
In Reply To:sort函数我是不是用错了? Posted by:argforever at 2005-03-08 21:24:02
直接累加不就可以了~~
#include<iostream.h>
int main()
{
  long n,i,j,k,l,p,q;
  cin>>n; cin>>k;
  j = 0;
  for (i = 1; i <= n; i++)
  {
    cin>>l;
    p = 1;
    for (q = 1; q <= k; q++) p = p * l;
    if (p > 0) j = j + p;
  }
  cout<<j<<endl;
  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