Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- public class Pyramids
- {
- public static void Main()
- {
- long n = 15;//long.Parse(Console.ReadLine());// 299; //
- StringBuilder builder = new StringBuilder();
- long c = 0;
- long i = 1;
- for (; i <= n; i++)
- {
- c = c + i;
- if (c > n)
- break;
- builder.Append("1 ");
- Console.WriteLine(builder.ToString());
- }
- Console.WriteLine(i - 1);
- //Console.WriteLine(c);
- Console.ReadKey();
- }
- }
- /*
- Coki went to Egypt once. Since then he loves pyramids. As all of us know, Coki also loves numbers...
- Sooooo, the expected result is that Coki wants to make pyramids of blocks with numbers!
- You have N blocks. With these blocks you should form pyramids.
- Each pyramid is actually a right-angled, isosceles triangle with one cathetus on the surface (see example). Also, you can think of the triangle as a set of columns, where the leftmost is 1 and the rightmost is the highest. The Kth column has exactly K blocks on top one another.
- Your task is to find the total number of full columns, given a total of N blocks
- Input
- Read from the standard input
- On the single line, find the number N
- Output
- Print to the standard output
- Print the number of full columns for N
- Constraints
- 1 <= N <= 2^50^
- Sample tests
- Input
- Copy
- 5
- Output
- Copy
- 2
- Explanation
- Copy
- o
- o o
- o o
- Input
- Copy
- 8
- Output
- Copy
- 3
- Explanation
- Copy
- o
- o o
- o o
- o o o
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement