{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eWilliam Macfarlane wants to look at an array.\u003c/p\u003e\r\n\u003cp\u003eYou are given a list of\u0026nbsp;\u003cstrong\u003eN\u0026nbsp;\u003c/strong\u003enumbers and\u0026nbsp;\u003cstrong\u003eQ\u0026nbsp;\u003c/strong\u003equeries. Each query is specified by two numbers\u0026nbsp;\u003cem\u003ei\u0026nbsp;\u003c/em\u003eand\u0026nbsp;\u003cem\u003ej\u003c/em\u003e; the answer to each query is the sum of every number between the range [i, j] (inclusive).\u003c/p\u003e\r\n\u003cp\u003e\u003cem\u003eNote:\u0026nbsp;\u003c/em\u003ethe query ranges are specified using 0-based indexing.\u003c/p\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThe first line contains\u0026nbsp;\u003cstrong\u003eN\u003c/strong\u003e, the number of integers in our list (\u003cstrong\u003eN \u0026lt;\u003d 100,000\u003c/strong\u003e). The next line holds\u0026nbsp;\u003cstrong\u003eN\u003c/strong\u003e\u0026nbsp;numbers that are guaranteed to fit inside an integer. Following the list is a number\u0026nbsp;\u003cstrong\u003eQ\u0026nbsp;\u003c/strong\u003e(\u003cstrong\u003eQ \u0026lt;\u003d 10,000\u003c/strong\u003e). The next\u0026nbsp;\u003cstrong\u003eQ\u003c/strong\u003e\u0026nbsp;lines each contain two numbers\u0026nbsp;\u003cstrong\u003ei\u003c/strong\u003e\u0026nbsp;and\u0026nbsp;\u003cstrong\u003ej\u0026nbsp;\u003c/strong\u003ewhich specify a query you must answer (\u003cstrong\u003e0 \u0026lt;\u003d i, j \u0026lt;\u003d N-1\u003c/strong\u003e).\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each query, output the answer to that query on its own line in the order the queries were made.\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1 4 1\n3\n1 1\n1 2\n0 2\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n5\n6\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}