Submission #1170182


Source Code Expand

Copy
using System;
using System.Collections.Generic;
public class Aprob {
    public static void Main() {
        int X = int.Parse(Console.ReadLine());
        int check = 0;
        int count = 0;
        for (int i = 1; check < X; i++) {
            check += i;
            count++;
        }
        if (check == X) {
            Console.WriteLine(count);
        } else {
            check -= count;
            count--;
            int check1 = count+(X - check) * 2;
            int test = check + count + 1;
            test = test - X;
            int check2 = count+X*2;
            check -= count;
            count--;
            int check3 = count + (X - check - count);
            Console.WriteLine(Math.Min(Math.Min(check1,check2),check3));
        }
    }
}

Submission Info

Submission Time
Task C - Go Home
User shomu36
Language C# (Mono 4.6.2.0)
Score 0
Code Size 795 Byte
Status
Exec Time 20 ms
Memory 11092 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt, 0_002.txt
All 0 / 200 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt
Case Name Status Exec Time Memory
0_000.txt 19 ms 9044 KB
0_001.txt 20 ms 11092 KB
0_002.txt 20 ms 11092 KB
1_003.txt 20 ms 11092 KB
1_004.txt 20 ms 11092 KB
1_005.txt 19 ms 11092 KB
1_006.txt 19 ms 11092 KB
1_007.txt 19 ms 9044 KB
1_008.txt 19 ms 9044 KB
1_009.txt 19 ms 9044 KB
1_010.txt 20 ms 11092 KB
1_011.txt 20 ms 11092 KB
1_012.txt 20 ms 11092 KB
1_013.txt 19 ms 9044 KB
1_014.txt 20 ms 11092 KB
1_015.txt 19 ms 11092 KB
1_016.txt 20 ms 11092 KB
1_017.txt 19 ms 11092 KB