Submission #19724109


Source Code Expand

Copy
//using AtCoder;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        //SourceExpander.Expander.Expand();

        var N = long.Parse(ReadLine());

        var ans = func2(N);

        WriteLine(ans);

        static long func1(long N)
        {
            var ans = 0L;
            for (int m = 1; m <= N; m++)
            {
                if (N / m == N % m)
                    ans += m;
            }

            return ans;
        }

        static long func2(long N)
        {
            var ans = 0L;
            for (int qr = 1; qr <= Sqrt(N - 1); qr++)
            {
                if (N % qr == 0)
                {
                    var m = N / qr - 1;
                    if (N / m == N % m)
                        ans += m;
                }
            }

            return ans;
        }
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}

Submission Info

Submission Time
Task D - DivRem Number
User flo
Language C# (.NET Core 3.1.201)
Score 500
Code Size 1649 Byte
Status AC
Exec Time 104 ms
Memory 27484 KB

Compile Error

Program.cs(22,21): warning CS8321: The local function 'func1' is declared but never used [/imojudge/csharp/csharp.csproj]

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, rand_10.txt, rand_11.txt, rand_12.txt, rand_13.txt, rand_14.txt, rand_15.txt, rand_16.txt, rand_17.txt, rand_18.txt, rand_19.txt, rand_20.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 89 ms 26928 KB
hand_02.txt AC 81 ms 27192 KB
hand_03.txt AC 89 ms 27168 KB
rand_01.txt AC 95 ms 27196 KB
rand_02.txt AC 104 ms 27084 KB
rand_03.txt AC 97 ms 27176 KB
rand_04.txt AC 90 ms 27356 KB
rand_05.txt AC 102 ms 27192 KB
rand_06.txt AC 96 ms 26932 KB
rand_07.txt AC 90 ms 27172 KB
rand_08.txt AC 82 ms 27484 KB
rand_09.txt AC 88 ms 27048 KB
rand_10.txt AC 95 ms 27140 KB
rand_11.txt AC 82 ms 27120 KB
rand_12.txt AC 81 ms 27120 KB
rand_13.txt AC 84 ms 27156 KB
rand_14.txt AC 81 ms 27140 KB
rand_15.txt AC 83 ms 27356 KB
rand_16.txt AC 90 ms 27140 KB
rand_17.txt AC 98 ms 27192 KB
rand_18.txt AC 85 ms 27112 KB
rand_19.txt AC 86 ms 27084 KB
rand_20.txt AC 77 ms 27092 KB
sample_01.txt AC 83 ms 27416 KB
sample_02.txt AC 90 ms 27088 KB