Search found 293 matches

by chunyi81
Sat Jul 05, 2003 5:26 am
Forum: Volume 3 (300-399)
Topic: 320 - Border
Replies: 24
Views: 2472

Why 320 WA

I have tried to solove problem 320 Border in Java, tested with many test cases, all of which gives the correct output. But OJ gives WA. Why? Below is the Java source code I wrote for the problem: [java]import java.io.*; import java.util.*; class Main { static String ReadLn (int maxLg) { byte lin[] =...
by chunyi81
Tue Jul 01, 2003 5:15 am
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 26615

My program also fails for a group containing 2 persons only. It only prints out the data for 1 person only.
by chunyi81
Tue Jul 01, 2003 4:49 am
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 26615

Never mind, I think I found the problem. I forgot to consider the possibility that a group can have only 1 person.
by chunyi81
Sun Jun 29, 2003 4:25 pm
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 26615

Why 119 WA?

Here is my program for problem 119 in Java. I do not understand why the judge keeps on giving WA. My program works fine with the sample input and gives the correct output. [java]import java.io.*; import java.util.*; class Main { static String ReadLn (int maxLg) { byte lin[] = new byte [maxLg]; int l...
by chunyi81
Mon Jun 23, 2003 5:54 pm
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 21771

Problem 107 - time limit exceeded - need help

I am trying to solve problem 107 in Java, but the online judge kepps on giving me time limit exceeded. Could someone help please? Below is my code: [java]import java.io.*; import java.util.*; class Main { static String ReadLn (int maxLg) { byte lin[] = new byte [maxLg]; int lg = 0, car = -1; String ...
by chunyi81
Mon Jun 23, 2003 3:28 am
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 25905

Re: I need help. I'm trying to resolve problem 160 in java.

Hello :D : [java] void imprimeVeces(int veces){ if(ajuste == 15){ System.out.print("\n "); System.out.flush(); ajuste = 0; } if(veces < 100 && veces >= 10){ System.out.print(veces + " "); }else{ System.out.print(" " + veces + " "); } ajuste++; } }[/java] The messange that I received was: "Your prog...
by chunyi81
Mon Jun 23, 2003 3:21 am
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 25905

Are u trying to print out the prime factors using the code u posted? I think the problem is asking u to print the number of '2's, '3's, and so on that appears in n!, where n is a number. Read the problem description again. Here's what I did to solve this problem: Dynamic programming and a single-dim...
by chunyi81
Sat Jun 21, 2003 4:26 am
Forum: Volume 1 (100-199)
Topic: 152 - Tree's a Crowd
Replies: 30
Views: 4018

Help! Problem 152 Tree's a crowd WA!

[java]import java.io.*; import java.util.*; class Main { static String ReadLn (int maxLg) { byte lin[] = new byte [maxLg]; int lg = 0, car = -1; String line = ""; try { while (lg < maxLg) { car = System.in.read(); if ((car < 0) || (car == '\n')) break; lin [lg++] += car; } } catch (IOException e) { ...

Go to advanced search