84922024-01-19 08:50:30TortelliniJrSzigetek (35 pont)csharpAccepted 35/3582ms42296 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kerekpartura
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] val = new int[n];
            val[0] = d[0];
            val[1] = d[1] + d[0];
            for (int i = 2; i < n; i++)
            {
                val[i] = Math.Min(val[i - 1], val[i - 2]) + d[i];
            }
            Console.WriteLine(val[n - 1]);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/032ms22184 KiB
2Accepted0/082ms37800 KiB
3Accepted1/130ms23608 KiB
4Accepted1/129ms23932 KiB
5Accepted1/129ms23868 KiB
6Accepted1/129ms23792 KiB
7Accepted1/132ms24184 KiB
8Accepted2/235ms25388 KiB
9Accepted2/237ms25292 KiB
10Accepted2/239ms25928 KiB
11Accepted2/237ms26000 KiB
12Accepted2/237ms26136 KiB
13Accepted2/241ms27084 KiB
14Accepted2/245ms28680 KiB
15Accepted2/250ms29912 KiB
16Accepted2/259ms32956 KiB
17Accepted2/272ms36900 KiB
18Accepted2/274ms38744 KiB
19Accepted2/275ms39768 KiB
20Accepted2/278ms40448 KiB
21Accepted2/282ms41956 KiB
22Accepted2/282ms42296 KiB