![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 2 707 Pomógł: 290 Dołączył: 16.12.2008 Skąd: Śląsk Ostrzeżenie: (0%) ![]() ![]() |
Znalazłem pewien kod w JAVIe, który rozwiązuje mój problem.
http://stackoverflow.com/questions/3026263...=active#tab-top Niestety utknąłem w jego przepisywaniu.
Ten post edytował markonix 20.08.2013, 12:19:36 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 2 707 Pomógł: 290 Dołączył: 16.12.2008 Skąd: Śląsk Ostrzeżenie: (0%) ![]() ![]() |
Kod final String chars = "0123456789abcdefghijklmnopqrstuvwxyz"; int wordLength = 3; char[] alphabet = { 'a', 'b', 'c' }; for (int i = 0; i < Math.pow(wordLength, alphabet.length); i++) { String str = Integer.toString(i, alphabet.length); String result = ""; while (result.length() + str.length() < wordLength) result += alphabet[0]; for (char c : str.toCharArray()) result += alphabet[chars.indexOf(c)]; System.out.println(result); }
Takie coś mi wyszło, niestety zapętla się się w jakimś miejscu i wywala. Ten post edytował markonix 20.08.2013, 12:59:40 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.10.2025 - 09:05 |