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 |
Re:sort函数我是不是用错了?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator