{"id":5233,"date":"2022-05-27T01:20:08","date_gmt":"2022-05-26T16:20:08","guid":{"rendered":"https:\/\/suzutukiblog.com\/?p=5233"},"modified":"2022-05-27T03:17:48","modified_gmt":"2022-05-26T18:17:48","slug":"reverse-lookup","status":"publish","type":"post","link":"https:\/\/suzutukiblog.com\/index.php\/2022\/05\/27\/reverse-lookup\/","title":{"rendered":"Ruby\u9006\u5f15\u304d\u30fb\u6761\u4ef6\u5206\u5c90\u7de8\u30fb\u57fa\u790e(\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u554f\u984c\u7528\u30fb\u81ea\u5206\u7528)"},"content":{"rendered":"<div class=\"inr1\">\n<h3>\u4f8b\u984c1 \u5076\u6570\u304b\uff1f\u5947\u6570\u304b\uff1f\uff08.odd? .even?\uff09<\/h3>\n<p>\u6570\u5024\u304c\u5947\u6570\u3060\u3063\u305f\u3089&#8221;OK&#8221;\u5076\u6570\u3060\u3063\u305f\u3089&#8221;NG&#8221;\u3068\u51fa\u529b\u3057\u305f\u3044\u6642<\/p>\n<\/div>\n<div class=\"sample-container\">\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\"><code>3\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\"><code>OK\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>6\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>NG<\/code><\/pre>\n<\/div>\n<\/div>\n<h3>\u89e3\u7b54:\u5947\u6570\u3067\u3042\u308b\u304b\u8abf\u3079\u305f\u3044\u3068\u304d\u306f.odd?\u5076\u6570\u306e\u3068\u304d\u306f.even?\u3092\u4f7f\u3046\u3002<\/h3>\n<pre>\uff03 \u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308b\uff08\u6570\u5024\uff09\r\n\r\nn = gets.to_i\r\n\r\n# \uff4e\u304c\u5947\u6570\u306e\u6642OK\u3092\u51fa\u529b\u3057\u3066\u3001\u5076\u6570\u306e\u6642\u306fNG\u3092\u51fa\u529b\u3059\u308b\r\n\r\nputs answer = n.odd? ? \"OK\" : \"NG\"<\/pre>\n<h3>\u4f8b\u984c2\u00a0 \u301c\u4ee5\u4e0a\u301c\u672a\u6e80\u304b\u3069\u3046\u304b\uff1f<\/h3>\n<h3>\u30a8\u30bf\u30ce\u30fc\u30eb(\u30a2\u30eb\u30b3\u30fc\u30eb)\u306e\u6cb8\u70b9\u306f78.37\u00b0C\u3067\u3059\u3002\u30a8\u30bf\u30ce\u30fc\u30eb\u3068\u6c34\u306e\u6df7\u5408\u7269\u3092\u52a0\u71b1\u3057\u3066\u84b8\u7559\u3059\u308b\u6642\u306b\u6e29\u5ea6\u309275\u2103\u4ee5\u4e0a80\u2103\u672a\u6e80\u3067\u7dad\u6301\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3057\u305f\u3002\u6e29\u5ea6\u8a08\u304c75\u2103\u4ee5\u4e0a80\u2103\u672a\u6e80\u306e\u3068\u304d\u306f&#8221;OK&#8221;\u3068\u51fa\u529b\u3057\u3001\u305d\u308c\u4ee5\u5916\u306e\u6e29\u5ea6\u306e\u3068\u304d\u306f&#8221;NG&#8221;\u3092\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u4e0b\u3055\u3044\u3002<\/h3>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\"><code>76\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\"><code>OK\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>86\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>NG<\/code><\/pre>\n<\/div>\n<h3>\u89e3\u7b54 t &gt;= 75 &amp;&amp; t &lt; 80 \u306775\u4ee5\u4e0a80\u672a\u6e80\u3092\u8868\u73fe\u3067\u304d\u308b<\/h3>\n<pre>\uff03 \u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308b\uff08\u6570\u5024\uff09\r\n\r\nt = gets.to_i\r\n\r\n#75\u2103\u4ee5\u4e0a80\u2103\u672a\u6e80\u3092\u8868\u73fe\u3067\u304d\u308b\r\n\r\nputs t &gt;= 75 &amp;&amp; t &lt; 80 ? \"OK\" : \"NG\"<\/pre>\n<h3>\u4f8b\u984c3 \u4efb\u610f\u306e\u30e2\u30ce\u3092\u6570\u3048\u308b( .count() ) \u5024\u3092\u6bd4\u8f03\u3057\u3066\u6761\u4ef6\u5206\u5c90\u3057\u3066\u51fa\u529b\u3059\u308b\u3002<\/h3>\n<h3>\u52dd\u3061\u8ca0\u3051\u306e\u7d50\u679c\u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002W\u304cL\u3088\u308a\u3082\u591a\u3051\u308c\u3070Win\u3001W\u304cL\u3088\u308a\u3082\u5c11\u306a\u3051\u308c\u3070Lose\u3068\u51fa\u529b\u3057\u3066\u3001W\u3068L\u304c\u540c\u3058\u5834\u5408\u306fDraw\u3068\u51fa\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002<\/h3>\n<div class=\"sample-container\">\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\"><code>W W W L W L W\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b1<\/div>\n<pre class=\"sample-content__input\">Win<\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>W L L W L W W L W L\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>Draw\r\n<\/code><\/pre>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u5165\u529b\u4f8b2<\/div>\n<pre class=\"sample-content__input\"><code>W L L L W L W L\r\n<\/code><\/pre>\n<\/div>\n<div class=\"sample-content\">\n<div class=\"sample-content__title\">\u51fa\u529b\u4f8b3<\/div>\n<pre class=\"sample-content__input\">Lose<\/pre>\n<\/div>\n<h3>\u89e3\u7b54 .count\u3067\u4efb\u610f\u306e\u30e2\u30ce\u3092\u6570\u3048\u3066\u5024\u3092\u6bd4\u8f03\u3057\u3066\u6761\u4ef6\u5206\u5c90\u3059\u308b\u3002<\/h3>\n<pre># \u534a\u89d2\u30b9\u30da\u30fc\u30b9\u523b\u307f\u306e\u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308a\u3001\u6570\u5024\u306b\u5909\u63db\u3059\u308b\r\n\r\nary = gets.split(' ')\r\n\r\n\uff03 ary\u306e\u4e2d\u306bW\u304c\u4f55\u500b\u3042\u308b\u304b\u6570\u3048\u3066\u4ee3\u5165\r\n\r\nwin = ary.count(\"W\")\r\n\r\n\uff03 ary\u306e\u4e2d\u306bL\u304c\u4f55\u500b\u3042\u308b\u304b\u6570\u3048\u3066\u4ee3\u5165\r\n\r\nlose = ary.count(\"L\")\r\n\r\n\uff03 win\u304close\u3088\u308a\u3082\u591a\u3044\u6642\u306f\u201dWin\"win\u3068lose\u304c\u540c\u3058\u6642\u306f\u201dDraw\"\r\n# win\u304close\u3088\u308a\u3082\u5c11\u306a\u3044\u6642\u306f\u201dLose\"\u3068\u6761\u4ef6\u5206\u5c90\u3057\u3066\u51fa\u529b\u3059\u308b\u3002\r\n\r\nif win &gt; lose \r\n  puts \"Win\"\r\nelsif win == lose\r\n  puts \"Draw\"\r\nelsif win &lt; lose\r\n  puts \"Lose\"\r\nend<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4f8b\u984c1 \u5076\u6570\u304b\uff1f\u5947\u6570\u304b\uff1f\uff08.odd? .even?\uff09 \u6570\u5024\u304c\u5947\u6570\u3060\u3063\u305f\u3089&#8221;OK&#8221;\u5076\u6570\u3060\u3063\u305f\u3089&#8221;NG&#8221;\u3068\u51fa\u529b\u3057\u305f\u3044\u6642 \u5165\u529b\u4f8b1 3 \u51fa\u529b\u4f8b1 OK \u5165\u529b\u4f8b2 6 \u51fa\u529b\u4f8b2 N [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[37],"tags":[],"class_list":["post-5233","post","type-post","status-publish","format-standard","hentry","category-reverse-lookup"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=5233"}],"version-history":[{"count":7,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5233\/revisions"}],"predecessor-version":[{"id":5253,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5233\/revisions\/5253"}],"wp:attachment":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=5233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=5233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=5233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}