문제: app.codility.com/programmers/lessons/5-prefix_sums/count_div/
double a = (double)A;
double b = (double)B;
double result = 0;
//for(int i = A; i <= B; i++)
//{
// if (i % K == 0)
// result = result + 1;
//}
result = Math.Floor(b / K) - Math.Floor((a - 1) / K);
return (int)result;
'공부하자 > Codility' 카테고리의 다른 글
[Codility] Lesson5. MinAvgTwoSlice (C#) (0) | 2020.11.17 |
---|---|
[Codility] Lesson5. GenomicRangeQuery (C#) (0) | 2020.11.17 |
[Codility] Lesson4. PermCheck (C#) (0) | 2020.11.17 |
[Codility] Lesson4. MissingInteger (C#) (0) | 2020.11.17 |
[Codility] Lesson4. MaxCounters (C#) (0) | 2020.11.17 |