{"id":166,"date":"2018-12-26T08:35:48","date_gmt":"2018-12-26T05:35:48","guid":{"rendered":"http:\/\/is42-2018.susu.ru\/surinda\/?p=166"},"modified":"2018-12-26T08:35:48","modified_gmt":"2018-12-26T05:35:48","slug":"zadacha-74","status":"publish","type":"post","link":"https:\/\/is42-2018.susu.ru\/surinda\/2018\/12\/26\/zadacha-74\/","title":{"rendered":"\u0417\u0430\u0434\u0430\u0447\u0430 74"},"content":{"rendered":"<p><strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 A, \u0438\u043c\u0435\u044e\u0449\u0443\u044e N \u0441\u0442\u0440\u043e\u043a \u0438 M \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0437 N + 1 \u0441\u0442\u0440\u043e\u043a \u0438 M + 1 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/strong><br \/>\n<!--more--><\/p>\n<pre>\r\nimport random\r\n\r\nN = 2  # \u0441\u0442\u0440\u043e\u043a\r\nM = 3  # \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432\r\n\r\n\r\ndef get_row(column):\r\n    col = []\r\n    for i in range(0, column):\r\n        col.append(random.randint(-9, 9))\r\n\r\n    return col\r\n\r\n\r\ndef get_matrix(row, column):\r\n    matrix = []\r\n    for i in range(0, row):\r\n        matrix.append(get_row(column))\r\n\r\n    return matrix\r\n\r\n\r\ndef print_matrix(matrix):\r\n    i = 0\r\n    while i &lt; len(matrix):\r\n        j = 0\r\n        row = matrix[i]\r\n        while j &lt; len(row):\r\n            column = row[j]\r\n            print(column, end=' ')\r\n            j += 1\r\n\r\n        print()\r\n        i += 1\r\n\r\n\r\nA = get_matrix(N, M)\r\nprint(\"\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430:\")\r\nprint_matrix(A)\r\n\r\nnew_row = []\r\n\r\ni = 0\r\nwhile i &lt; len(A):\r\n    j = 0\r\n\r\n    count_row_negative = 0\r\n    while j &lt; len(A[i]):\r\n        is_negative = A[i][j] &lt; 0\r\n\r\n        if is_negative:\r\n            count_row_negative += 1\r\n\r\n        if len(new_row) &lt;= j:\r\n            new_row.append(1 if is_negative else 0)\r\n        else:\r\n            new_row[j] += 1 if is_negative else 0\r\n\r\n        j += 1\r\n\r\n    A[i].append(count_row_negative)\r\n    i += 1\r\n\r\nA.append(new_row)\r\n\r\nprint(\"\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430:\")\r\nprint_matrix(A)\r\n<\/pre>\n<p><a href=\"http:\/\/tpcg.io\/r9zdbZ\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 A, \u0438\u043c\u0435\u044e\u0449\u0443\u044e N \u0441\u0442\u0440\u043e\u043a \u0438 M \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0437 N + 1 \u0441\u0442\u0440\u043e\u043a \u0438 M + 1 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/posts\/166"}],"collection":[{"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":1,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/posts\/166\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/is42-2018.susu.ru\/surinda\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}