different ways of Mathematical Plays

Правка en2, от kali.ok, 2016-06-14 16:47:34

in the last contest i have participate there a problem called "Johny Likes Numbers" " 678A - Johny Likes Numbers " as i found the shortest c++ solution was using one line


#include <cstdio> int main() { int n, k; scanf("%d %d",&n, &k); printf("%d\n",(n / k + 1) * k); }

how i can found this short formula to solve mathematical problems i've tried on several problems that had mathematical formula and found it's very hard to get it done can anyone advice me to get more powerful in problems like this ?

Теги math, formula, shortest code, help me

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский kali.ok 2016-06-14 16:47:34 71
en1 Английский kali.ok 2016-06-14 16:46:23 593 Initial revision (published)