Skip to main content
Utilized integer division
Source Link
NonlinearFruit
  • 5.8k
  • 1
  • 29
  • 43

Java 8, 88 70 6057 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(Math.max(0,(int)(10700*a-v)/70d70/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -3 [16-08-19] Utilized integer division
  • -10 [16-08-18] Removed unnecessary import, thanks to @OlivierGrégoire!
  • -18 [16-08-17] Return string instead of print

Java 8, 88 70 60 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(Math.max(0,(int)(10-v/70d/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -10 [16-08-18] Removed unnecessary import, thanks to @OlivierGrégoire!
  • -18 [16-08-17] Return string instead of print

Java 8, 57 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(Math.max(0,(700*a-v)/70/a))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -3 [16-08-19] Utilized integer division
  • -10 [16-08-18] Removed unnecessary import, thanks to @OlivierGrégoire!
  • -18 [16-08-17] Return string instead of print
Removed unnecessary import
Source Link
NonlinearFruit
  • 5.8k
  • 1
  • 29
  • 43

Java 8, 88 7070 60 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -10 [16-08-18] Removed unnecessary import, thanks to @OlivierGrégoire!
  • -18 [16-08-17] Return string instead of print

Java 8, 88 70 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -18 [16-08-17] Return string instead of print

Java 8, 88 70 60 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(Math.max(0,(int)(10-v/70d/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -10 [16-08-18] Removed unnecessary import, thanks to @OlivierGrégoire!
  • -18 [16-08-17] Return string instead of print
Return string instead of print
Source Link
NonlinearFruit
  • 5.8k
  • 1
  • 29
  • 43

Java 8, 8888 70 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the 10 asterisk stringanswer.

(v,a)->System.out.print("**********">"**********".substring(java.lang.Math.max(0,10-(int)(10-v/70d/a))))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ voidString f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(39673067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 8870
            (v,a)->System.out.print("**********">"**********".substring(java.lang.Math.max(0,10-(int)(10-v/70d/a))))
        );
    }
}

Update

  • -18 [16-08-17] Return string instead of print

Java 8, 88 bytes

Uses a lambda to save bytes and substrings the 10 asterisk string.

(v,a)->System.out.print("**********".substring(java.lang.Math.max(0,10-(int)(v/70d/a))))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ void f(int v, int a);}
    static void g(h H){
        H.f(163,2);System.out.println("\t**");
        H.f(548,22);System.out.println("\t*");
        H.f(1452,24);System.out.println("\t*");
        H.f(1713,37);System.out.println("\t*");
        H.f(4162,32);System.out.println("\t**");
        H.f(3967,15);System.out.println("\t***");
        H.f(22421,19);System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 88
            (v,a)->System.out.print("**********".substring(java.lang.Math.max(0,10-(int)(v/70d/a))))
        );
    }
}

Java 8, 88 70 bytes

Uses a lambda to save bytes, performs the calculation and substrings to return the answer.

(v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))

Here is my class for testing it.

public class DifficultyCalculator{
    static interface h{ String f(int v, int a);}
    static void g(h H){
        System.out.print(H.f(163,2));System.out.println("\t**");
        System.out.print(H.f(548,22));System.out.println("\t*");
        System.out.print(H.f(1452,24));System.out.println("\t*");
        System.out.print(H.f(1713,37));System.out.println("\t*");
        System.out.print(H.f(4162,32));System.out.println("\t**");
        System.out.print(H.f(3067,15));System.out.println("\t***");
        System.out.print(H.f(22421,19));System.out.println("\t**********");
    }
    public static void main(String[] args) {
        g( // 70
            (v,a)->"**********".substring(java.lang.Math.max(0,(int)(10-v/70d/a)))
        );
    }
}

Update

  • -18 [16-08-17] Return string instead of print
Source Link
NonlinearFruit
  • 5.8k
  • 1
  • 29
  • 43
Loading