Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Sheets
- {
- class Sheets
- {
- static void Main()
- {
- int number = int.Parse(Console.ReadLine());
- List<int> sheet = new List<int>() { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 };
- while (number > 0)
- {
- if (number < sheet[sheet.Count - 1])
- {
- for (int i = 0; i < sheet.Count; i++)
- {
- if (sheet[i] > number)
- {
- number -= sheet[i - 1];
- sheet.Remove(sheet[i - 1]);
- break;
- }
- else if (sheet[i] == number)
- {
- number -= sheet[i];
- sheet.Remove(sheet[i]);
- break;
- }
- }
- }
- else if (number >= sheet[sheet.Count - 1])
- {
- number -= sheet[sheet.Count - 1];
- sheet.Remove(sheet[sheet.Count - 1]);
- }
- }
- foreach (int rest in sheet)
- {
- switch (rest)
- {
- case 1: Console.WriteLine("A10"); break;
- case 2: Console.WriteLine("A9"); break;
- case 4: Console.WriteLine("A8"); break;
- case 8: Console.WriteLine("A7"); break;
- case 16: Console.WriteLine("A6"); break;
- case 32: Console.WriteLine("A5"); break;
- case 64: Console.WriteLine("A4"); break;
- case 128: Console.WriteLine("A3"); break;
- case 256: Console.WriteLine("A2"); break;
- case 512: Console.WriteLine("A1"); break;
- case 1024: Console.WriteLine("A0"); break;
- default: break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement