fork(13) download
  1. using System;
  2.  
  3. namespace X
  4. {
  5. class T
  6. {
  7. static void Main(string[] a)
  8. {
  9. int m = int.Parse( Console.ReadLine()), n = int.Parse( Console.ReadLine());
  10. Console.WriteLine("m:{0}, n:{1} -> {2}", m, n, f(n,m));
  11. }
  12. static string f(long s,int l)
  13. {
  14. decimal x = s;
  15. for (int i = 0; i < 20; x = (((x * x) + s) / (2 * x)), i++) ;
  16. var b=x.ToString(string.Format("F{0}", l));
  17. return(x.ToString().Contains("."))?b.Substring(0,l+1):b.Substring(0,l);
  18. }
  19. }
  20. }
Success #stdin #stdout 0.05s 37064KB
stdin
2
10000
stdout
m:2, n:10000 -> 10