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

java 1003 ac codes

Posted by mfkidtfws at 2009-08-22 15:42:47 on Problem 1003
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int[] card = new int[522];
		double sum = 0;
		int i = 2;
		int j = 1;
		int p;
		while (sum < 5.21) {
			sum += (1/((double)(i)));
			p = ((int)(sum * 100));
			for (; j <= p; j++) {
				card[j] = i - 1;
			}
			j = p + 1;
			i++;
		}
		int input;
		while((input = ((int)(in.nextDouble() * 100))) != 0) {
			System.out.println(card[input] + " card(s)");
		}
	}
}

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