using System; using System.IO; using System.Text.RegularExpressions; public class Problem1 { public static void Main() { FileStream file = new FileStream("DATA3.txt", FileMode.Open); StreamReader sr = new StreamReader(file); String temp = sr.ReadToEnd(); String[] lines = Regex.Split(temp, "\n"); FileStream file2 = new FileStream("OUT3.txt", FileMode.Create); StreamWriter sw = new StreamWriter(file2); foreach (String ln in lines) { if (ln.Length > 1) { int surface = 0; int num = Convert.ToInt32(ln); int first = Convert.ToInt32(Math.Pow(Convert.ToDouble(num), (1.0 / 3.0))); Console.WriteLine(first); surface = first * first * 6; sw.WriteLine(surface); } } sw.Close(); file2.Close(); } }