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.h> #include<stdio.h> int main() { long nl,ng,n; long array[5000000]; scanf("%d %d %d",ng,nl,n); for(int v=0;v<n;v++) scanf("%d",&array[v]); while(nl!=0&&ng!=0&&n!=0) { for(int i=0;i<n;i++) for(int j=i;j<n;j++) { if(array[i]>array[j]) { long temp=array[i]; array[i]=array[j]; array[j]=temp; } } long sum=0; //init and updata ,continue,,,,, for(int e=nl;e<n-ng;e++) sum=sum+array[e]; sum=sum/(n-ng-nl); //output result. printf("%0.6f\n",sum); //get new data for input . scanf("%d %d %d",ng,nl,n); for(int b=0;b<n;b++) scanf("%d",&array[b]); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator