{"id":117,"date":"2017-02-14T16:46:00","date_gmt":"2017-02-14T08:46:00","guid":{"rendered":"https:\/\/cn1.club\/?p=117"},"modified":"2025-03-13T20:12:18","modified_gmt":"2025-03-13T12:12:18","slug":"day3-%e7%ac%94%e8%ae%b0-%e9%94%ae%e7%9b%98%e5%bd%95%e5%85%a5%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a0%bc%e5%bc%8f-%e4%b8%8e%e8%ae%b2%e8%a7%a3%e7%bb%83%e4%b9%a0","status":"publish","type":"post","link":"https:\/\/cn1.club\/?p=117","title":{"rendered":"Day3 \u7b14\u8bb0 \u952e\u76d8\u5f55\u5165\u7684\u57fa\u672c\u683c\u5f0f \u4e0e\u8bb2\u89e3\u7ec3\u4e60"},"content":{"rendered":"\n<p><strong>\u7ec3\u4e601:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >import java.util.Scanner;\t\t\t\t\t\/\/\u5bfc\u5165\u5305\u4e2d\u7684\u7c7b Scanner\nclass Test2_Scanner {\n\tpublic static void main(String&#091;] args) {\n\t\t\/\/\u952e\u76d8\u5f55\u5165\u7ec3\u4e60:\u952e\u76d8\u5f55\u5165\u4e24\u4e2a\u6570\u636e,\u5e76\u5bf9\u8fd9\u4e24\u4e2a\u6570\u636e\u6c42\u548c,\u8f93\u51fa\u5176\u7ed3\u679c.\n\t\t\/*\n\t\tScanner sc =new Scanner(System.in);\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u4e00\u4e2a\u6574\u6570&quot;);\n\t\tint x = sc.nextInt();\n\t\tSystem.out.println(&quot;\u60a8\u5e0c\u671b&quot; + x + &quot;\u52a0\u591a\u5c11\u5462?&quot;);\n\t\tint y = sc.nextInt();\n\n\t\tSystem.out.println(x + &quot; x &quot; + y + &quot;\u7b49\u4e8e :&quot; );\n\n\t\tSystem.out.println(x + y);\n\t\tSystem.out.println(&quot;\u5956\u52b1: RICK,\u60a8\u5f97\u5230\u4e86&#091;&quot; + x + y + &quot;]\u4e2a\u94bb\u77f3 &quot;);\n\t\t*\/\n\t\t\n\t\t\/\/\u952e\u76d8\u5f55\u5165\u7ec3\u4e60:\u952e\u76d8\u5f55\u5165\u4e24\u4e2a\u6570\u636e,\u83b7\u53d6\u8fd9\u4e24\u4e2a\u6570\u636e\u5176\u4e2d\u6700\u5927\u7684\u503c\n\t\tScanner sc =new Scanner(System.in);\t\t\t\t\t\/\/\u521b\u5efa\u952e\u76d8\u5f55\u5165\u5bf9\u8c61\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u8981\u6bd4\u7684\u7b2c\u4e00\u4e2a\u6574\u6570:&quot;);\t\t\n\t\tint a = sc.nextInt();\t\t\t\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165\u53d8\u91cfa\u4e2d\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u8981\u6bd4\u7684\u6574\u6570:&quot;);\n\t\tint b = sc.nextInt();\t\t\t\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165\u53d8\u91cfb\u4e2d\n\t\tSystem.out.println(&quot;\u8bf7\u7a0d\u7b49&quot;);\n\t\tint max ;\t\t\t\t\t\t\t\t\t\t\t\/\/\u521b\u5efaint\u7c7b\u578b max\u53d8\u91cf\n\t\tmax = ( a &gt; b ) ? a:b;\t\t\t\t\t\t\t\t\/\/\u83b7\u53d6a \u548c b \u4e2d\u7684\u6700\u5927\u503c\n\t\tSystem.out.println(&quot;\u60a8\u597d!\u60a8\u8f93\u5165\u7684&quot; + a + &quot;\u548c&quot; + b + &quot;\u4e2d,\u6700\u5927\u7684\u662f: &quot;+ max);\n\n\n\t}\n}<\/code><\/pre>\n\n\n\n<p><strong>\u7ec3\u4e602:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >import java.util.Scanner;\t\t\t\t\t\t\t\/\/\u5bfc\u5305\n\/*\n1.\u952e\u76d8\u5f55\u5165\u7ec3\u4e60:\u952e\u76d8\u5f55\u5165\u4e24\u4e2a\u6570\u636e,\u6bd4\u8f83\u8fd9\u4e24\u4e2a\u6570\u636e\u662f\u5426\u76f8\u7b49.\n2.\u952e\u76d8\u5f55\u5165\u7ec3\u4e60:\u952e\u76d8\u5f55\u5165\u4e09\u4e2a\u6570\u636e,\u83b7\u53d6\u8fd9\u4e09\u4e2a\u6570\u636e\u4e2d\u7684\u6700\u5927\u503c.\n*\/\n\nclass Test3_Scanner {\n\tpublic static void main(String&#091;] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\/\/\u521b\u5efa\u952e\u76d8\u5f55\u5165\u5bf9\u8c61\n\t\t\/*\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u6574\u6570&quot;);\n\t\tint x = sc.nextInt();\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u8981\u6bd4\u7684\u6574\u6570&quot;);\n\t\tint y = sc.nextInt();\n\t\t\n\t\t\/\/boolean b = (x == y) ? true : false\n\t\tboolean b = (x == y);\n\t\tSystem.out.println(b);\n\t\t*\/\n\t\t\n\t\t\/\/------------\u7b2c\u4e8c\u9898:\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u6574\u6570:&quot;);\n\t\tint a = sc.nextInt();\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165a\u4e2d\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u6574\u6570:&quot;);\n\t\tint b = sc.nextInt();\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165b\u4e2d\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e09\u4e2a\u6574\u6570:&quot;);\n\t\tint c = sc.nextInt();\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165c\u4e2d\n\t\tSystem.out.println(&quot;\u8bf7\u8f93\u5165\u7b2c\u56db\u4e2a\u6574\u6570:&quot;);\n\t\tint d = sc.nextInt();\t\t\t\t\t\/\/\u5c06\u952e\u76d8\u5f55\u5165\u7684\u6570\u636e\u5b58\u5165d\u4e2d\n\t\n\n\t\t\/\/\u4ee5\u4e0a\u5df2\u5f55\u5165\u56db\u4e2a\u6574\u6570,\u4ee5\u4e0b\u5f00\u59cb\u8ba1\u7b97\u5176\u4e2d\u8c01\u662f\u6700\u5927\u7684\u503c.\n\t\tint max1 = (a &gt; b) ? a : b;\t\t\t\t\t\t\/\/\u5c06a\u4e0eb\u6bd4\u51fa\u6700\u5927\u7684\u4e00\u4e2a\u503c,\u5b58\u5165max1\u4e2d\n\t\tint max2 = (c &gt; d) ? c : d;\t\t\t\t\t\t\/\/\u5c06c\u4e0ed\u6bd4\u51fa\u6700\u5927\u7684\u4e00\u4e2a\u503c,\u5b58\u5165max2\u4e2d\n\t\tint smax = (max1 &gt; max2) ? max1 : max2;\t\t\t\/\/\u5c06max1\u4e0emax2\u6bd4\u51fa\u6700\u5927\u7684\u4e00\u4e2a\u503c\u5b58\u5165smax\u4e2d\n\t\tSystem.out.println(&quot;\u6309\u5148\u540e\u987a\u5e8f\u60a8\u8f93\u5165\u4e86:&quot; + a + &quot; .&quot; + b + &quot; .&quot; + c +&quot; .&quot;+ d + &quot;\u6700\u5927\u7684\u503c\u4e3a:&quot;+ smax + &quot;\u8ba1\u7b97\u5b8c\u6210&quot;);\n\t\tSystem.out.println(&quot;RICK 2017.02.14&quot;);\n\n\t}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7ec3\u4e601: \u7ec3\u4e602:<\/p>\n","protected":false},"author":1,"featured_media":196,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xuexi"],"_links":{"self":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":0,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/media\/196"}],"wp:attachment":[{"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}