fork download
  1. import std.stdio;
  2. int solve (int area) {
  3. int res = 6, total = 1;
  4. while (true)
  5. foreach (p; 0..6) {
  6. if (total >= area) return res;
  7. res += 1;
  8. total += res / 6 - !p;
  9. }
  10. }
  11. void main () {
  12. int n;
  13. readf (" %s", &n);
  14. writeln (solve (n));
  15. }
  16.  
Success #stdin #stdout 0s 4368KB
stdin
1000000000
stdout
109548