Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#1
- using System;
- //using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Unit4.BucketLib;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Bucket[] buckets = new Bucket[6];
- for (int i = 0; i < buckets.Length; i++)
- buckets[i] = new Bucket(50, i.ToString());
- double ammount = 50.0;
- for (int i = 0; i < buckets.Length; i++)
- {
- buckets[i].Fill(ammount);
- ammount /= 2.0;
- }
- }
- }
- }
- //2
- using System;
- //using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Unit4.BucketLib;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- Bucket[] buckets = new Bucket[n];
- for (int i = 0; i < buckets.Length; i++)
- buckets[i] = new Bucket(20, i.ToString());
- Random rng = new Random();
- double max = 0;
- for (int i = 0; i < buckets.Length; i++)
- {
- double randomNum = (double)rng.Next(21);
- if (randomNum > max)
- max = randomNum;
- buckets[i].Fill(randomNum);
- }
- for (int i = 0; i < buckets.Length; i++)
- buckets[i].Fill(max - buckets[i].GetCurrentAmount());
- }
- }
- }
- //#3
- using System;
- //using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Unit4.BucketLib;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- Bucket[] buckets = new Bucket[n];
- int[] ammounts = new int[n];
- Random rng = new Random();
- for (int i = 0; i < buckets.Length; i++)
- buckets[i] = new Bucket(rng.Next(11), i.ToString());
- for (int i = 0; i < buckets.Length; i++)
- {
- int randomNumber = rng.Next(buckets[i].GetCapacity());
- buckets[i].Fill((double)randomNumber);
- ammounts[i] = randomNumber;
- }
- int j = 1;
- while (j < ammounts.Length)
- {
- if (ammounts[j] < ammounts[j - 1])
- {
- int holder = ammounts[j - 1];
- ammounts[j - 1] = ammounts[j];
- ammounts[j] = holder;
- if (j != 1)
- j--;
- }
- else
- {
- j++;
- }
- }
- for (int i = 0; i < ammounts.Length; i++)
- Console.WriteLine(ammounts[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement