tag:blogger.com,1999:blog-2597841815280998418.post780197261108171375..comments2024-03-12T06:45:01.935+01:00Comments on This Thread: Codility CountDivMannyhttp://www.blogger.com/profile/07393063644320426727noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-2597841815280998418.post-8279611890545712782016-07-03T21:11:20.381+02:002016-07-03T21:11:20.381+02:00Hello Marian, thank you for contributing!Hello Marian, thank you for contributing!Mannyhttps://www.blogger.com/profile/07393063644320426727noreply@blogger.comtag:blogger.com,1999:blog-2597841815280998418.post-58733242894417895712016-06-29T13:19:45.346+02:002016-06-29T13:19:45.346+02:00int solution(int A, int B, int K) {
// write y...int solution(int A, int B, int K) {<br /> // write your code in C++11 (g++ 4.8.2)<br /> return (B/K)-(((long long int)A+K-1))/K+1;<br />}Anonymoushttps://www.blogger.com/profile/04690919197816587230noreply@blogger.comtag:blogger.com,1999:blog-2597841815280998418.post-81405661334855967252016-02-04T16:01:33.717+01:002016-02-04T16:01:33.717+01:00Hi, thank you for asking, and sorry for the very l...Hi, thank you for asking, and sorry for the very late reply.<br />You are kind of right in being perplexed. The fact is that using integers in this context is not incidental but inherently part of the problem. I have added a few lines at the end of the post trying to clarifying the point.Mannyhttps://www.blogger.com/profile/07393063644320426727noreply@blogger.comtag:blogger.com,1999:blog-2597841815280998418.post-46507752117683445802015-08-08T16:50:46.728+02:002015-08-08T16:50:46.728+02:00Hello,
why isn't this equivalent to ( (last-fi...Hello,<br />why isn't this equivalent to ( (last-first) / div ) + !(first % div) ?<br />This should be the same mathematically, but programmatically, it isn't the same due to precision operation.<br />could you explain it please ? Anonymousnoreply@blogger.com