Timeline for Leibniz golf in C#
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 22, 2015 at 19:28 | comment | added | Juan Carlos Oropeza |
You are right Mono C# compiler 3.2.8.0 .NET 4.0 CLR . But dont worry about it, I learn a lot. Thanks
|
|
Apr 22, 2015 at 19:21 | comment | added | VisualMelon |
@JuanCarlosOropeza that's irritating, I wonder if it's an ancient version of C# or something (or maybe it's mono and it does more than reject perfectly valid uses of goto ). In that case, I have a one-byte longer version without it (I'll write this up properly some other time): using System;class S{static void Main(){Func<int>L=()=>int.Parse(Console.ReadLine());for(int n=L();n-->0;){double r=0,t=L(),j=0;for(;j<t;)r+=(1-j%2*2)/(2*j+++1);Console.WriteLine(r);}}
|
|
Apr 22, 2015 at 19:20 | comment | added | Peter Taylor |
There's no reason why n can't be a double... See my answer.
|
|
Apr 22, 2015 at 19:10 | comment | added | Juan Carlos Oropeza |
Looks like I cant use using C=System.Console; Say `System.Console' is a type not a namespace
|
|
Apr 22, 2015 at 19:06 | comment | added | Juan Carlos Oropeza | Yes, That part I try putting the variable inside the loop and couldnt access outside. | |
Apr 22, 2015 at 19:04 | comment | added | VisualMelon |
@PeterTaylor unfortunately it doesn't seem to pay to move the doubles outside of the for loop, and you need access to r below (which you don't have if you define it in the for loop initial expression)
|
|
Apr 22, 2015 at 19:03 | comment | added | Peter Taylor |
Point 1 applies to the second for loop too.
|
|
Apr 22, 2015 at 18:53 | history | answered | VisualMelon | CC BY-SA 3.0 |