6 ms·
I don't understand why this only gets a score of 1: static String[] c = { "", "FizzBuzz", "Buzz", "Fizz" }; public static void main(String[] args)
by hallowtech 14y ago
I don't understand why this only gets a score of 1:
static String[] c = { "", "FizzBuzz", "Buzz", "Fizz" };
public static void main(String[] args)
{
for(int i = 1; i <= 100; i++)
{
c[0] = ""+i;
int f = ((int)Math.ceil((i%3)/3.0))+1;
int b = ((int)Math.ceil((i%5)/5.0))*2;
System.out.println(c[(f+b)%4]);
}
}
- ricardobeat 14y agoBecause it's huge and this is a code golf challenge?
- hallowtech 14y ago=\ No point in trying with Java then?
- Tuna-Fish 14y agoYou can do some decent golfing in Java. For improvement, how about removing all the casts, FP arithmetic, everything from Math, etc?