Skip to content

Instantly share code, notes, and snippets.

@neo125874
Created July 22, 2016 08:05
Show Gist options
  • Save neo125874/e81f0e8cebb780d461c27bee34ded20a to your computer and use it in GitHub Desktop.
Save neo125874/e81f0e8cebb780d461c27bee34ded20a to your computer and use it in GitHub Desktop.

Revisions

  1. neo125874 created this gist Jul 22, 2016.
    18 changes: 18 additions & 0 deletions FrogJmp.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    using System;
    // you can also use other imports, for example:
    // using System.Collections.Generic;

    // you can write to stdout for debugging purposes, e.g.
    // Console.WriteLine("this is a debug message");

    class Solution {
    public int solution(int X, int Y, int D) {
    if ((Y - X) < D && Y != X) return 1;

    var r = (double)( (Y - X) + ((Y-X)%D) ) / D;

    return (int)Math.Ceiling(r);

    // write your code in C# 6.0 with .NET 4.5 (Mono)
    }
    }