Skip to content

Instantly share code, notes, and snippets.

@joriki
Created March 3, 2022 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joriki/6c73c579192f7e553b7061e124917209 to your computer and use it in GitHub Desktop.
Save joriki/6c73c579192f7e553b7061e124917209 to your computer and use it in GitHub Desktop.
public class Question4395079 {
public static void main (String [] args) {
int sum = 0;
outer:
for (int i = 1;i <= 99999;i++) {
int bits = 0;
for (char c : String.valueOf(i).toCharArray()) {
int mask = 1 << (c - '0');
if ((bits & mask) != 0)
continue outer;
bits |= mask;
}
sum += i;
}
System.out.println("sum : " + sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment