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

這是我做的第一題﹐老是Compile Error﹐不知什么原因。。。。。。

Posted by BachelorLrz at 2007-08-02 21:30:15 on Problem 1338
import java.util.Scanner;
class UglyNumbers{
    public static void main(String[] args)
	{
		short[] outArray = new short[1000];
		int i = 0;
	    while (true)
		{		    
		    Scanner sc = new Scanner(System.in);
			short in = sc.nextShort();
			outArray[i] = getUglyNamber(in);
			if(in == 0) break;
			i++;
		}
		for(int j=0;j<i;j++)
		{
            System.out.println(outArray[j]+"");
		}	    
	}
	public static short getUglyNamber(short in)
	{
		short temp = 1;
		short result = 1;
	    while(true)
		{
		    if(result%2==0 || result%3==0 || result%5==0) temp++;
			if(temp >= in) break;			
			result++;
		}
	    return result;
	}
}

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