Hirdetés
- Samsung Galaxy A52s 5G - jó S-tehetség
- Bemutatkozott a Poco X7 és X7 Pro
- Néhány Pixelnél Wi‑Fi és Bluetooth hibákat hozott a januári frissítés
- Apple Watch
- CES 2026: Aláírjuk a Motorola Signature mutatós külsejét
- Realme GT 2 Pro - papírforma
- Telekom mobilszolgáltatások
- Google Pixel topik
- Szívós, szép és kitartó az új OnePlus óra
- Android alkalmazások - szoftver kibeszélő topik
Új hozzászólás Aktív témák
-
pmonitor
aktív tag
válasz
joysefke
#9468
üzenetére
Én így fordítottam át:
using System;
namespace IsmPerm
{
class Program
{
static int findCeilInt(int[] str, int first, int l, int h)
{
int ceilIndex = l;
for (int i = l + 1; i <= h; i++)
if (str[i] > first && str[i] < str[ceilIndex])
ceilIndex = i;
return ceilIndex;
}
static void Teszt_1(int[] tomb)
{ //https://www.geeksforgeeks.org/print-all-permutations-of-a-string-with-duplicates-allowed-in-input-string/
int size = tomb.Length;
Array.Sort(tomb);
bool isFinished = false;
while (!isFinished)
{
int x = 1, i;
for (int k = 0; k < size; ++k) Console.Write("{0} ", tomb[k]);
Console.WriteLine("");
for (i = size - 2; i >= 0; --i) if (tomb[i] < tomb[i + 1]) break;
if (i == -1) isFinished = true;
else
{
int ceilIndex = findCeilInt(tomb, tomb[i], i + 1, size - 1);
int temp = tomb[i];
tomb[i] = tomb[ceilIndex];
tomb[ceilIndex] = temp;
Array.Sort(tomb, i + 1, size - i - 1);
}
}
}
static void Main(string[] args)
{
int[] tomb = new int[] { 500, 500, 600, 600, 700};
Teszt_1(tomb);
Console.ReadKey();
}
}
}
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Szinte Új HYPERX Cloud II metál gaming headset Bolti ár:33k INGYEN FOXPOST
- ÚJ HP HyperX Cloud II Bolti ár:40k INGYEN FOXPOST
- MSI P4MAM2-V Retro félkonfig, 1 GB DDR RAM, Pentium 4 2,8 GHz CPU, Windows XP
- Creative Sound Blaster 16 (CT2230) Retro ISA hangkártya
- ÚJ HP HyperX Cloud Alpha Bolti ár:30k INGYEN FOXPOST
- HIBÁTLAN iPhone 15 Pro 128GB Blue Titanium -1 ÉV GARANCIA -Kártyafüggetlen
- Keresünk iPhone 16/16e/16 Plus/16 Pro/16 Pro Max
- Felsőkategóriás AMD Gamer PC-Számítógép! Beszámítás! R7 9800X3D / 9070XT / 32GB DDR5 / 2TB SSD!
- Akció! Bontatlan Sandisk Ultra 3D SSD 1TB
- iKing.Hu Apple iPhone 17 Pro Deep Blue ProMotion 120 Hz újszerű 100% akku Apple garancia 202
Állásajánlatok
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs
Cég: Laptopműhely Bt.
Város: Budapest


