-
-
Save dbasch/f212a600f8170576db9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class y{static int s(int x){return(x<1?x:x%10+s(x/10));}public static void main(String a[]){int i=0,j=0;for(;i++<1e6;j+=s(i)==42?1:0);System.out.print(j);}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Java 8 does improve things. I actually tried to change your for loop to use Java 8 as well:
Although arguably more readable, your crazy minified for loop ended up shorter due to the need to import
IntStream
and spell out1e6
fully :)