|
|
вернуться в форумAC 0.015 120 КБ Послано martin 5 май 2012 14:44 #include <iostream> #include <stdio.h> int main() { long n,k,t; scanf("%ld%ld",&n,&k); t=2*(n/k)+(n%k!=0)+((n%k>k/2.0)||(n<k)); printf("%ld\n",t); return 0; } Edited by author 05.05.2012 14:45 Edited by author 05.05.2012 14:45 Re: AC 0.015 120 КБ Послано martin 5 май 2012 14:48 but sometimes 0.031. Don't know why.. Edited by author 05.05.2012 15:05 another approach Послано esger 31 май 2012 13:52 result is n/k+1 + (n-1+n%k)/k to avoid WA8 check if k is greater than n. Re: another approach Can you explain it for me? I can't understand this formular.(sorry for my English) |
|
|