CountDiv

 1         /// <summary>
 2         /// Solution
 3         /// 100/100
 4         /// </summary>
 5         /// <param name="A"></param>
 6         /// <param name="B"></param>
 7         /// <param name="K"></param>
 8         /// <returns></returns>
 9         public int solution(int A, int B, int K)
10         {
11             if (A % K == 0 || B % K == 0)
12             {
13                 return (B - A) / K + 1;
14             }
15             else
16             {
17                 if (A > K)
18                 {
19                     return (B - A) / K;
20                 }
21                 else
22                 {
23                     return B / K;
24                 }
25             }
26         }

 

posted @ 2015-07-25 01:16  叫我霍啊啊啊  阅读(130)  评论(0编辑  收藏  举报