{"id":101,"date":"2010-02-12T22:02:00","date_gmt":"2010-02-12T14:02:00","guid":{"rendered":"http:\/\/localhost\/?p=101"},"modified":"2010-02-12T22:02:00","modified_gmt":"2010-02-12T14:02:00","slug":"ural_100910121013_k-based_numbersversion_1-3","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=101","title":{"rendered":"Ural 1009,1012,1013 K-based numbers,Version 1-3"},"content":{"rendered":"<p> \u66b4\u51b7\u3002\u3002\u76f4\u63a5DP \u4e00\u4e2a\u7a0b\u5e8fA3\u9898\u3002\u3002 <br \/>Java\u7684\u9ad8\u7cbe\u5ea6\u5b9e\u5728\u592a\u65e0\u654c\u4e86\u3002\u3002<br \/>import java.util.*;<br \/>import java.math.*;<br \/>public class Main<br \/>{<br \/> static Scanner in=new Scanner(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">System<\/a>.in);<br \/> public static void main(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Ajava.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">String<\/a> args[])<br \/> {<br \/>  int n,k;<br \/> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a> notZero,zero;<br \/>  n=in.nextInt();k=in.nextInt();<br \/>  zero=<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.valueOf(0);notZero=<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.valueOf(k-1);<br \/>  for(int i=1;i&lt;n;i++)<br \/>  {<br \/> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a> nZero,nNotZero;<br \/>   nZero=notZero;<br \/>   nNotZero=zero.add(notZero).multiply(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.valueOf(k-1));<br \/>   zero=nZero;<br \/>   notZero=nNotZero;<br \/>  }<br \/> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">System<\/a>.out.println(zero.add(notZero));<br \/> }<br \/>} <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u66b4\u51b7\u3002\u3002\u76f4\u63a5DP \u4e00\u4e2a\u7a0b\u5e8fA3\u9898\u3002\u3002 Java\u7684\u9ad8\u7cbe\u5ea6\u5b9e\u5728\u592a\u65e0\u654c\u4e86\u3002\u3002import java.util.*;import java.math.*;public class Main{ static Scanner in=new Scanner(System.in); public static void main(String args[]) { int n,k; BigInteger notZero,zero; n=in.nextInt();k=in.nextInt(); zero=BigInteger.valueOf(0);notZero=BigInteger.valueOf(k-1); for(int i=1;i&lt;n;i++) { BigInteger nZero,nNotZero; nZero=notZero; nNotZero=zero.add(notZero).multiply(BigInteger.valueOf(k-1)); zero=nZero; notZero=nNotZero; } System.out.println(zero.add(notZero)); }}<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/101"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}