Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Problem02
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- long brickOne = long.Parse(Console.ReadLine());
- long brickTwo = long.Parse(Console.ReadLine());
- long brickThree = long.Parse(Console.ReadLine());
- long countOfRows = long.Parse(Console.ReadLine());
- Console.WriteLine(brickOne);
- Console.WriteLine("{0} {1}", brickTwo, brickThree);
- for (int i = 3; i <= countOfRows; i++)
- {
- for (int k = 1; k <= i; k++)
- {
- long currentBrick = brickThree + brickTwo + brickOne;
- brickOne = brickTwo;
- brickTwo = brickThree;
- brickThree = currentBrick;
- if (k == i)
- {
- Console.Write(currentBrick);
- }
- else
- {
- Console.Write(currentBrick);
- Console.Write(" ");
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment