fork download
  1. using System;
  2.  
  3. namespace CodingTest
  4. {
  5. class Class1
  6. {
  7. static void Main(string[] args)
  8. {
  9. int num = int.Parse(Console.ReadLine()), count = 0;
  10. while (num != 0)
  11. {
  12. int temp = (int)Math.Sqrt(num);
  13. temp = (int)Math.Pow(temp, 2);
  14. num -= temp;
  15. count++;
  16. }
  17. Console.WriteLine(count);
  18. }
  19. }
  20. }
  21.  
Success #stdin #stdout 0.03s 22744KB
stdin
18
stdout
3