C# Submissions now possible in Linux with .NET Core

The forum to report every bug you find or tell us what you'd like to find in UVa OJ

Moderator: Board moderators

Post Reply
ryansealy
New poster
Posts: 1
Joined: Thu Jan 19, 2017 5:11 am

C# Submissions now possible in Linux with .NET Core

Post by ryansealy » Thu Jan 19, 2017 5:30 am

With the release of .NET Core by Microsoft, I request that UVA Online judge reconsider adding a C# option for the submissions.

Much has changed since some of these old posts were written:
viewtopic.php?t=12859
viewtopic.php?t=15536

1. C# is now a very different language than C++ and offers some very creative ways to solve problems with style.

2. .Net Core is open source and can run on Linux.

UVA is awesome. I want to help make it even better. With the addition of C#, I expect you will see a big boost in usage and notoriety. In my case, I would love to be able to issue challenges to my software developers to solve problem X within a 2 hour time frame and offer prizes to the first to solve, shortest code, fastest code, etc. but it isn't practical with my staff to solve with anything other than C#. As a developer, I want to challenge myself to solve these in the most eloquent way possible using the tools I use for my job everyday.

Here's my favorite C# 3n+1, which cannot be trivially ported to C++.

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static IEnumerable<uint> Cycles(uint n) { while (n > 1) yield return n = n % 2 == 1 ? 3 * n + 1 : n / 2; }
    static void Main() {
        for (;;) {
            var inputs = Console.ReadLine().Split(' ').Select(input => int.Parse(input)).ToArray();
            if (inputs.All(input => input == 0)) break;
            Console.WriteLine(string.Format("{0} {1} {2}", inputs[0], inputs[1], Enumerable.Range(inputs.Min(), inputs.Max() - inputs.Min() + 1).Select(n => Cycles((uint)n).Count() + 1).Max()));
        }
    }
}

Post Reply

Return to “Bugs and suggestions”