Topic: 帮忙看一下为何这个程序要用2M多的mem |
Print this page |
1.帮忙看一下为何这个程序要用2M多的mem | Copy to clipboard |
Posted by: wx_ray_1987 Posted on: 2007-03-13 10:48 import java.util.*; public class Solution { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); for (int i = n - 1; i >= 2; i--) { //get the maximum cofactor of i and n int a = n, b = i; int rest = a % b; while (rest != 0) { a = b; b = rest; rest = a % b; } if (b == 1) { System.out.println(i); return; } } System.out.println(1); } } |
2.Re:帮忙看一下为何这个程序要用2M多的mem [Re: wx_ray_1987] | Copy to clipboard |
Posted by: cxp108 Posted on: 2007-03-13 23:14 LZ是如何得出这个程序占用2M的内存的? 进程管理器? top? |
3.Re:帮忙看一下为何这个程序要用2M多的mem [Re: wx_ray_1987] | Copy to clipboard |
Posted by: bluecrystal Posted on: 2007-03-14 13:34 有什么问题呢,随便写个java程序,在windows里面加载,进程管理器里面看都有几m |
4.Re:帮忙看一下为何这个程序要用2M多的mem [Re: wx_ray_1987] | Copy to clipboard |
Posted by: lililixiong Posted on: 2007-04-20 09:16 我晕,这个程序实现的条件是JDK1.50版本以上 搞了我半天,我都没找出错误用了个奇怪的类 |
5.Re:帮忙看一下为何这个程序要用2M多的mem [Re: bluecrystal] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2007-04-22 06:23 bluecrystal wrote: how about Linux? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |