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

此题如何降低内存需求(尽可能不影响速度)?

Posted by zj262144 at 2012-02-15 12:36:41 on Problem 1004 and last updated at 2012-02-15 13:23:01
虽然AC了(这题本来就是用来练手的吧),不过看到排行榜上(指GCC和C),内存用的相当少

而本人写的
#include <stdio.h>
int main(){
  float i, sum = 0.0;
  int c = 0;
  for (;c < 12; ++c){
    scanf("%f", &i);
    sum += i;
  }
  printf("$%.2f\n", sum/12);
  return 0;
}
用到了180K(虽然时间上都是0MS)
即便把scanf那里复写12次(取消c这个变量),结果也是180K

请问有大牛知道怎么缩减内存使用么?

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