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

Re:帮帮忙 程序正确运行 提交却出错误 求教

Posted by 1131992658 at 2010-09-12 13:22:23 on Problem 1003
In Reply To:帮帮忙 程序正确运行 提交却出错误 求教 Posted by:xoliuxiao at 2010-01-30 10:24:15
> Compile Error
> 
> Main.java:5: class HangOver is public, should be declared in a file named HangOver.java
> public class HangOver {
>        ^
> 1 error
> 程序如下
> package HangOver;
>  
> import java.util.Scanner;
> 
> public class HangOver {
> 
> 	
> 	public static void main(String[] args) {
> 		float n, length, getNumber = 0;
> 		Scanner getNumber1 = new Scanner(System.in);
> 		getNumber = getNumber1.nextFloat();
> 		for (n = 1, length = 0; length < getNumber; n++) {
> 			length = length + 1 / (n + 1);
> 
> 		}
> 		System.out.println(n - 1);
> 
> 	}
> 
> }
> 
> 

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