ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1209. 1, 10, 100, 1000...

What is wrong (Runtime error)? - C#
Posted by Vladislav 4 Jul 2015 10:16
using System;
class Program{
    static void Main(){
        string[] input = Console.ReadLine().Split(new char[]{' ', '\t', '\n'}, StringSplitOptions.RemoveEmptyEntries);
        string Result = "";
        double temp;
        for (int i = 1; i <= Int32.Parse(input[0]); i++){
        temp = Math.Sqrt(((Int32.Parse(input[i]) - 1) * 8) + 1);
            temp = (temp - 1) / 2;
            if (temp % 1 == 0)
                Result += "1 ";
            else
                Result += "0 ";
        }
        Console.WriteLine(Result);
    }
}

Edited by author 04.07.2015 10:47