Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace P08_Condense_Array_to_Number
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int[] condensed = new int[nums.Length - 1];
- if(nums.Length == 1)
- {
- Console.WriteLine(nums[0]);
- return;
- }
- for (int i = 0; i < nums.Length; i++)
- {
- for (int j = 0; j < condensed.Length - i; j++)
- {
- condensed[j] = nums[j] + nums[j + 1];
- }
- condensed = nums;
- }
- Console.WriteLine(condensed[0]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement