34212023-02-27 13:44:03tothgergelyTáblajátékcsharpPartially correct 38/5037ms25696 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            ulong sor = 0;
            ulong hely = 0;
            foreach (var i in l)
            {
                if (i == 0)
                {
                    sor++;
                    hely = hely * 2;
                }
                if (i == 1)
                {
                    sor++;
                    hely = hely * 2 + 1;
                }
                if (i == 2)
                {
                    sor--;
                    hely = hely / 2;
                }
                if (i == 3)
                {
                    hely--;
                }
                if (i == 4)
                {
                    hely++;
                }


            }
            Console.WriteLine(sor);
            if (hely == 0)
            {
                Console.WriteLine("0");
            }
            else
            {
                string bin = "";
                while (hely != 0)
                {
                    bin = hely % 2 + bin;
                    hely = hely / 2;
                    
                }
                Console.WriteLine(bin);
            }

            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/032ms22116 KiB
2Accepted0/032ms22652 KiB
3Accepted3/332ms22956 KiB
4Accepted3/332ms23460 KiB
5Accepted3/332ms23508 KiB
6Partially correct1/330ms23724 KiB
7Accepted3/332ms23612 KiB
8Accepted3/332ms23892 KiB
9Accepted3/330ms23796 KiB
10Partially correct1/337ms24432 KiB
11Accepted3/330ms24164 KiB
12Partially correct1/337ms24964 KiB
13Accepted4/432ms24804 KiB
14Partially correct1/435ms25688 KiB
15Accepted4/432ms24968 KiB
16Partially correct1/437ms25696 KiB
17Accepted4/432ms25240 KiB