/** * Culture * Problem 1, AIC 2003 * C# Sample Solution */ using System; using System.IO; public class Culture { public static void Main(string[] args ) { // Open the I/O files. StreamReader sr = new StreamReader("cultin.txt"); StreamWriter sw = new StreamWriter("cultout.txt"); // Read in the total number of bacteria. int total = int.Parse(sr.ReadLine()); // Assume the experiment has been running for 0 days. long start = total; long days = 0; // While the initial number of bacteria is still even, halve this // initial number and add one day to the experiment. while (start % 2 == 0) { start = start / 2; days++; } // Now the initial number of bacteria is odd, so we must have our // solution. sw.WriteLine(start + " " + days); // Close the output file. sw.Close(); } }