{"id":203,"date":"2010-01-24T11:18:04","date_gmt":"2010-01-24T16:18:04","guid":{"rendered":"http:\/\/serjudging.vanb.org\/?p=203"},"modified":"2014-08-16T12:05:02","modified_gmt":"2014-08-16T16:05:02","slug":"d-knitting","status":"publish","type":"post","link":"http:\/\/serjudging.vanb.org\/?p=203","title":{"rendered":"D: Knitting"},"content":{"rendered":"<p>Knitting was one of the two easiest problems in the set (Minesweeper is the other), and was solved by most teams.<\/p>\n<p>Here&#8217;s the <a href=\"http:\/\/vanb.org\/ser2009\/knitting.judge\">Judge Input<\/a>, the <a href=\"http:\/\/vanb.org\/ser2009\/knitting.solution\">Judge Output<\/a>, the main <a href=\"http:\/\/vanb.org\/ser2009\/knitting.java\">Solving Program<\/a>, another <a href=\"http:\/\/vanb.org\/ser2009\/knitting_chinmay.java\">solution<\/a>, and <a href=\"http:\/\/vanb.org\/ser2009\/knittingYiu.java\">another<\/a>.<\/p>\n<p>There&#8217;s a pseudocode  solution in the spoiler.<br \/>\n[spoiler]<br \/>\nThe only real trick is to recognize that the numbers are so small that you don&#8217;t need fancy math. Just iterate through it.<\/p>\n<pre>\r\n    Input numberOfRows, firstRow, numberOfDeltas, deltas\r\n    stitchesOnRow = firstRow\r\n    total = 0;\r\n    For i = 0 to numberOfRows-1\r\n        total = total + stitchesOnRow\r\n        stitchesOnRow = stitchesOnRow + deltas[i mod numberOfDeltas]\r\n    End\r\n    Print total\r\n<\/pre>\n<p>[\/spoiler]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Knitting was one of the two easiest problems in the set (Minesweeper is the other), and was solved by most teams. Here&#8217;s the Judge Input, the Judge Output, the main Solving Program, another solution, and another. There&#8217;s a pseudocode solution in the spoiler. [spoiler] The only real trick is to recognize that the numbers are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":4,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":207,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/207"}],"wp:attachment":[{"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/serjudging.vanb.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}