Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void ThreadStart(object item)
|
||||
{
|
||||
Thread.Sleep(1000 * (int)item);
|
||||
Console.WriteLine(item);
|
||||
}
|
||||
|
||||
static void SleepSort(IEnumerable<int> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
new Thread(ThreadStart).Start(item);
|
||||
}
|
||||
}
|
||||
|
||||
static void Main(string[] arguments)
|
||||
{
|
||||
SleepSort(arguments.Select(int.Parse));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
var input = new[] { 1, 9, 2, 1, 3 };
|
||||
|
||||
foreach (var n in input)
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(n * 1000);
|
||||
Console.WriteLine(n);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue