æè¿ç©ã®åå ¸åã話é¡ã«ãªã£ã¦ããã®ã§æ¸ãã¾ãã Nåã®ãã¹ç®ã横ä¸åã«ä¸¦ãã§ããç¶æ³ãèãã¾ããåããå ¨é¨ã®ãã¹ã¯ç½è²ã§ãããã®ãã¡ K åã®ãã¹ãé¸ãã§é»ãå¡ã£ãæã«ã§ãããã¹ã®ç¶æ ã¯ä½éãã§ããããï¼ ããã ãããã ããã¯ãéãã§ãã ãããå¿ç¨ããã¨ã次ã®ãããªåé¡ã解ãã¾ãã é·ãã N ã§ãã£ã¦ãç·åã M ã§ããéè² æ´æ°åã®åæ°ãæ±ããã éè² æ´æ°åã¨ããã®ã¯ãåè¦ç´ ãè² ã®æ°ã§ãªãæ´æ°ãããªãæ°åã§ãã[1, 2, 3, 4, 5] ã¨ã [0, 0, 1, 4, 3] ã¨ãã§ããããã®åæ°ãæ°ããã®ã«ãå ã»ã©ã®ãã¹ã®æ°ãæ¹ã使ããã¨ãã§ãã¾ãã ã¾ãã M + N - 1 åã®ç½ããã¹ç®ãç¨æãã¾ãããã®ãã¨ããããã N - 1 ãã¹é¸ãã§å¡ãã¾ããããããã¨ããå¿ ã M åã®ãã¹ãç½ãã¾ã¾ã§æ®ã£ã¦ãã¾ããã¾ãããã¹ã®ä¸¡ç«¯ãé»ãã¹ãå¢ç®ã¨ãã¦èããã¨ãç½ããã¹ãé£ç¶ãã
{{#tags}}- {{label}}
{{/tags}}