Advertisement
Guest User

Sheets

a guest
Apr 1st, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2. class Sheets
  3. {
  4.     static void Main()
  5.     {
  6.         int pieces = int.Parse(Console.ReadLine());
  7.  
  8.         for (int sheetSize = 0, piesePerSheet = 1024; sheetSize <= 10; sheetSize++, piesePerSheet /= 2)
  9.         {
  10.             if (pieces - piesePerSheet >= 0)
  11.             {
  12.                 pieces = pieces - piesePerSheet;
  13.             }
  14.             else
  15.             {
  16.                 Console.WriteLine("A{0}", sheetSize);
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement