{"height":"190","blog_url":"https://qnighy.hatenablog.com/","provider_url":"https://hatena.blog","blog_title":"\u7c21\u6f54\u306aQ","width":"100%","published":"2008-10-22 21:52:15","type":"rich","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fqnighy.hatenablog.com%2Fentry%2F20081022%2F1224679935\" title=\"JOI2006\u4e88\u90781 \u554f\u984c1\uff20Ruby(-53) - \u7c21\u6f54\u306aQ\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_name":"qnighy","url":"https://qnighy.hatenablog.com/entry/20081022/1224679935","categories":["100articles","Programming","TodaysJOI"],"version":"1.0","title":"JOI2006\u4e88\u90781 \u554f\u984c1\uff20Ruby(-53)","image_url":null,"author_url":"https://blog.hatena.ne.jp/qnighy/","description":"Ruby\u306fJava\u3088\u308a\u9045\u304b\u3063\u305f\u3002\u50d5\u306e\u597d\u304d\u306ascanf\u304c\u3042\u3063\u305f\u306e\u306f\u826f\u304b\u3063\u305f\u3002\u9006\u306bprintf\u306e\u66f8\u304d\u5fc3\u5730\u306fPython\u306e\u307b\u3046\u304c\u4e0a\u3002Perl\u306b\u305b\u3088Ruby\u306b\u305b\u3088\u3001\u306a\u3093\u3067range operator\u306f\u5168\u958b\u533a\u9593\u306a\u306e\u30fc\u30fc\u30fc\u30fc\uff01\uff1f\u304a\u304b\u3057\u3044\u3060\u308d\u5e38\u8003\uff01Python\u306exrange\u306f\u534a\u958b\u533a\u9593\u3060\u305e\u30fc\u30fc\uff01 #!/usr/bin/ruby require 'scanf' (n, ) = scanf(\"%d\\n\") sum_a = 0 sum_b = 0 (1..n).each do |i| (a, b) = scanf(\"%d %d\\n\") if a > b then sum_a += a + b elsif a == \u2026"}