{"id":5673,"date":"2022-10-10T14:14:50","date_gmt":"2022-10-10T05:14:50","guid":{"rendered":"https:\/\/suzutukiblog.com\/?p=5673"},"modified":"2022-10-17T10:02:44","modified_gmt":"2022-10-17T01:02:44","slug":"tips-10","status":"publish","type":"post","link":"https:\/\/suzutukiblog.com\/index.php\/2022\/10\/10\/tips-10\/","title":{"rendered":"TIPS(Ruby:\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u6a5f\u80fd\u305d\u306e2  \u7279\u5b9a\u306e\u65e5\u306e\u30dd\u30a4\u30f3\u30c8\u6570\u3092n\u500d\u3059\u308b)"},"content":{"rendered":"<h1>\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u6a5f\u80fd\u305d\u306e2<\/h1>\n<h3>\u554f\u984c<\/h3>\n<p>\u3068\u3042\u308b\u304a\u8089\u5c4b\u3055\u3093\u3067\u306f\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u3066\u3001\u8cb7\u3044\u7269\u3092\u3059\u308b\u305f\u3073\u306b\u8cfc\u5165\u91d1\u984d\u306b\u5fdc\u3058\u305f\u30dd\u30a4\u30f3\u30c8\u304c\u305f\u307e\u308a\u307e\u3059\u3002 \u52a0\u7b97\u3055\u308c\u308b\u30dd\u30a4\u30f3\u30c8\u306f\u6b21\u306e 3 \u3064\u306e\u30eb\u30fc\u30eb\u306b\u5f93\u3063\u3066\u6c7a\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>1. \u901a\u5e38\u306f\u8cfc\u5165\u91d1\u984d\u306e1\uff05(\u5c0f\u6570\u70b9\u4ee5\u4e0b\u5207\u308a\u6368\u3066)\u3068\u3059\u308b<br \/>\n2. 4\u306e\u3064\u304f\u65e5\u306f\u8cfc\u5165\u91d1\u984d\u306e4\uff05(\u5c0f\u6570\u70b9\u4ee5\u4e0b\u5207\u308a\u6368\u3066)\u3068\u3059\u308b<br \/>\n3. 29\u306e\u3064\u304f\u65e5\u306f\u8cfc\u5165\u91d1\u984d\u306e29\uff05(\u5c0f\u6570\u70b9\u4ee5\u4e0b\u5207\u308a\u6368\u3066)\u3068\u3059\u308b<\/p>\n<p>\u6700\u7d42\u7684\u306b\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u306b\u4f55\u30dd\u30a4\u30f3\u30c8\u3042\u308b\u304b\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002(\u5c0f\u6570\u70b9\u4ee5\u4e0b\u5207\u308a\u6368\u3066)<\/p>\n<h3>\u5165\u529b\u5024\u306b\u3064\u3044\u3066<\/h3>\n<p>\u5165\u529b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<dl class=\"txt2\">\n<dd>N\u3000\u3000\u3000\u3000#\u5404\u8cb7\u3044\u7269\u306e\u6570<\/dd>\n<dd>day_1 plice_1\u3000#1\u56de\u76ee\u306e\u8cb7\u3044\u7269\u306e\u65e5\u4ed8 day_1 \u65e5, \u8cfc\u5165\u91d1\u984d plice_1 \u5186<\/dd>\n<dd>day_2 plice_2\u3000#2\u56de\u3081\u306e\u8cb7\u3044\u7269\u306e\u65e5\u4ed8 day_2 \u65e5, \u8cfc\u5165\u91d1\u984d plice_2 \u5186<\/dd>\n<dd>&#8230;<\/dd>\n<dd>day_N plice_N\u3000#N\u679a\u76ee\u306e\u30ec\u30b7\u30fc\u30c8\u306e\u65e5\u4ed8 day_N \u65e5, \u8cfc\u5165\u91d1\u984d plice_N \u5186<\/dd>\n<\/dl>\n<h5>1\u884c\u76ee\u306b\u306f\u4eca\u6708\u5206\u306e\u8cb7\u3044\u7269\u306e\u56de\u6570\u3092\u8868\u3059\u6574\u6570 N \u304c\u5165\u529b\u3055\u308c\u307e\u3059\u3002<br \/>\n\u7d9a\u304f N \u884c\u306b\u306f\u5404\u8cb7\u3044\u7269\u306e\u60c5\u5831\u304c\u5165\u529b\u3055\u308c\u307e\u3059\u3002<\/h5>\n<h3>\u4e0e\u3048\u3089\u308c\u308b\u5165\u529b\u5024<\/h3>\n<pre class=\"sample-content__input\"><code>5\r\n2 1000\r\n14 2000\r\n15 4000\r\n24 3000\r\n29 29000<\/code><\/pre>\n<h3>\u671f\u5f85\u3059\u308b\u51fa\u529b<\/h3>\n<pre><code class=\"stdout ng-binding\">8660<\/code><\/pre>\n<h3>\u30b3\u30fc\u30c9\u3068\u89e3\u8aac<\/h3>\n<pre>#1\u884c\u76ee\u306e\u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308b\r\nn = gets.to_i\r\n\r\n#\u30dd\u30a4\u30f3\u30c8\u306f\u6700\u521d\u306f0\u306a\u306e\u30670\u3067\u521d\u671f\u5316\u3059\u308b\r\npoint = 0\r\n\r\n#n\u56de\u7e70\u308a\u8fd4\u3059\r\nn.times do |i|\r\n  #2\u884c\u540d\u4ee5\u964d\u306e\u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308b\r\n  day,plice = gets.split.map(&amp;:to_i)\r\n  \r\n  #4\u306e\u3064\u304f\u65e5\u306e\u51e6\u7406\u3092\u66f8\u304f\r\n  if day == 4 || day == 14 || day == 24 \r\n     \r\n  #4%\u306a\u306e\u3067\u5148\u306b\u8a08\u7b97\u3057\u3066\u304b\u3089.floor\u3067\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u5207\u308a\u6368\u3066\u308b\r\n     point += (plice.to_f \/ 100) * 4.floor\r\n  #29\u65e5\u306e\u51e6\u7406\u3092\u66f8\u304f\r\n  elsif day == 29\r\n  \r\n  #29%\u306a\u306e\u3067\u5148\u306b\u8a08\u7b97\u3057\u3066\u304b\u3089.floor\u3067\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u5207\u308a\u6368\u3066\u308b\r\n  point += (plice.to_f \/ 100) * 29.floor\r\n  \r\n  #\u666e\u901a\u306e\u65e5\u306f1%\u306a\u306e\u3067\u5148\u306b\u8a08\u7b97\u3057\u3066\u304b\u3089.floor\u3067\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u5207\u308a\u6368\u3066\u308b\r\n  else point += (plice.to_f \/ 100).floor\r\n  end\r\nend\r\n#\u30dd\u30a4\u30f3\u30c8\u3092\u51fa\u529b\u3059\u308b\r\nputs point.to_i<\/pre>\n<h2>https:\/\/paiza.io\/ja\/projects\/new<\/h2>\n<h2>\u2191\u3053\u3061\u3089\u306b\u30b3\u30d4\u30da\u3057\u3066\u300c\u5b9f\u884c\u300d\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/h2>\n<h2>\u2193\u3053\u306e\u3088\u3046\u306a\u51fa\u529b\u7d50\u679c\u306b\u306a\u3063\u3066\u3044\u308c\u3070OK\u3067\u3059\u3002<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5677\" src=\"https:\/\/suzutukiblog.com\/wp-content\/uploads\/2022\/09\/d6019a0124700d9fa0adef500083bffe.png\" alt=\"\" width=\"196\" height=\"164\" \/><\/p>\n<h3>\u203b\u30dd\u30a4\u30f3\u30c8<\/h3>\n<h2>.floor\u3067\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u5207\u308a\u6368\u3066\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u6a5f\u80fd\u305d\u306e2 \u554f\u984c \u3068\u3042\u308b\u304a\u8089\u5c4b\u3055\u3093\u3067\u306f\u30dd\u30a4\u30f3\u30c8\u30ab\u30fc\u30c9\u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u3066\u3001\u8cb7\u3044\u7269\u3092\u3059\u308b\u305f\u3073\u306b\u8cfc\u5165\u91d1\u984d\u306b\u5fdc\u3058\u305f\u30dd\u30a4\u30f3\u30c8\u304c\u305f\u307e\u308a\u307e\u3059\u3002 \u52a0\u7b97\u3055\u308c\u308b\u30dd\u30a4\u30f3\u30c8\u306f\u6b21\u306e 3 \u3064\u306e\u30eb\u30fc\u30eb\u306b\u5f93\u3063\u3066\u6c7a\u5b9a\u3055\u308c\u307e\u3059\u3002 1. \u901a\u5e38\u306f\u8cfc [&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":[27,31,32],"tags":[],"class_list":["post-5673","post","type-post","status-publish","format-standard","hentry","category-programming-note","category-ruby","category-tips"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5673","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=5673"}],"version-history":[{"count":6,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5673\/revisions"}],"predecessor-version":[{"id":5713,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5673\/revisions\/5713"}],"wp:attachment":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=5673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=5673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=5673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}