{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":748,"title":"Wrapping the Tower of Pisa","description":"The famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\r\n\r\nNote: inspired on problem 167","description_html":"\u003cp\u003eThe famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\u003c/p\u003e\u003cp\u003eNote: inspired on problem 167\u003c/p\u003e","function_template":"function y = paperneed(s,a)\r\n  y = s;\r\nend","test_suite":"%%\r\ns = pi;\r\na = pi^2;\r\ny_correct = 2*pi^4 + pi^3;\r\nassert(abs(paperneed(s,a)-y_correct)\u003c1e-12)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":4638,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":302,"test_suite_updated_at":"2012-06-06T20:53:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-05T11:41:10.000Z","updated_at":"2026-02-18T21:57:01.000Z","published_at":"2012-06-05T11:41:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote: inspired on problem 167\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43108,"title":"How many complete pizzas","description":"x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\r\n\r\nExample:\r\n\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n\r\nin the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u003e half a pizza.\r\nin the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u003e so half a pizza.\r\nin the third column we have 12 slices of a pizzas cut in 8 slices -\u003e1.5 slices.\r\n\r\nThis combines to 2.5 pizzas, so we have 2 complete pizzas!","description_html":"\u003cp\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e x = [1 3 12];\r\n n = [2 6 8];\u003c/pre\u003e\u003cp\u003ein the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u0026gt; half a pizza.\r\nin the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u0026gt; so half a pizza.\r\nin the third column we have 12 slices of a pizzas cut in 8 slices -\u0026gt;1.5 slices.\u003c/p\u003e\u003cp\u003eThis combines to 2.5 pizzas, so we have 2 complete pizzas!\u003c/p\u003e","function_template":"function y = completePizzas(x,n)\r\n  y = x;\r\nend","test_suite":"%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n%%\r\n x = [1 3 7];\r\n n = [2 6 8];\r\ny_correct = 1;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n%%\r\n x = [2 3 12];\r\n n = [2 6 8];\r\ny_correct = 3;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":94929,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2016-10-19T11:42:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T07:55:59.000Z","updated_at":"2026-02-17T14:21:36.000Z","published_at":"2016-10-06T07:55:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 3 12];\\n n = [2 6 8];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u0026gt; half a pizza. in the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u0026gt; so half a pizza. in the third column we have 12 slices of a pizzas cut in 8 slices -\u0026gt;1.5 slices.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis combines to 2.5 pizzas, so we have 2 complete pizzas!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":167,"title":"Pizza!","description":"Given a circular pizza with radius z and thickness a, return the pizza's volume. [ z is first input argument.]\r\nNon-scored bonus question: Why is the function interesting?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 102.5px 8px; transform-origin: 102.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a circular pizza with radius\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.5px 8px; transform-origin: 3.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ez\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.5px 8px; transform-origin: 45.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and thickness\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 88px 8px; transform-origin: 88px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return the pizza's volume. [\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.5px 8px; transform-origin: 3.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ez\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 74px 8px; transform-origin: 74px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is first input argument.]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 190px 8px; transform-origin: 190px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNon-scored bonus question: Why is the function interesting?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = pizza(z,a)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('pizza.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || ...\r\n          contains(filetext, 'if') || contains(filetext, 'switch'); \r\nassert(~illegal)\r\n\r\n%%\r\nz = 1;\r\na = 1;\r\nv_correct = pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 2;\r\na = 1;\r\nv_correct = 4*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 1;\r\na = 2;\r\nv_correct = 2*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 2;\r\na = 2;\r\nv_correct = 8*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n","published":true,"deleted":false,"likes_count":372,"comments_count":313,"created_by":39,"edited_by":223089,"edited_at":"2022-12-19T07:41:42.000Z","deleted_by":null,"deleted_at":null,"solvers_count":23804,"test_suite_updated_at":"2022-12-19T07:41:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-29T16:17:01.000Z","updated_at":"2026-04-13T22:53:58.000Z","published_at":"2012-01-29T16:21:23.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a circular pizza with radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ez\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and thickness\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return the pizza's volume. [\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ez\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is first input argument.]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNon-scored bonus question: Why is the function interesting?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44743,"title":"Pizza order","description":"A pizza order by phone in diameter d1, pizza will be make only in diameter d2.\r\nReturn the pizza pieces p should be make.(pizza can be cut into quarter)\r\n\r\n* for example: \r\n\r\n# di = 2, d2 = 1, p = 4\r\n# di = 1, d2 = 2, p = 0.25\r\n# di = 5, d2 = 7, p = 0.75\r\n","description_html":"\u003cp\u003eA pizza order by phone in diameter d1, pizza will be make only in diameter d2.\r\nReturn the pizza pieces p should be make.(pizza can be cut into quarter)\u003c/p\u003e\u003cul\u003e\u003cli\u003efor example:\u003c/li\u003e\u003c/ul\u003e\u003col\u003e\u003cli\u003edi = 2, d2 = 1, p = 4\u003c/li\u003e\u003cli\u003edi = 1, d2 = 2, p = 0.25\u003c/li\u003e\u003cli\u003edi = 5, d2 = 7, p = 0.75\u003c/li\u003e\u003c/ol\u003e","function_template":"function p = Pizza2(d1,d2)\r\n  p = 1;\r\nend","test_suite":"%%\r\nd1 = 2;d2 = 1;\r\nn_correct = 4;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 1;d2 = 2;\r\nn_correct = 0.25;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 5;d2 = 7;\r\nn_correct = 0.75;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 7;d2 = 5;\r\nn_correct = 2;\r\nassert(isequal(Pizza2(d1,d2),n_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":82229,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-10-10T08:58:25.000Z","updated_at":"2026-04-14T15:23:09.000Z","published_at":"2018-10-10T08:58:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA pizza order by phone in diameter d1, pizza will be make only in diameter d2. Return the pizza pieces p should be make.(pizza can be cut into quarter)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 2, d2 = 1, p = 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 1, d2 = 2, p = 0.25\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 5, d2 = 7, p = 0.75\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43615,"title":"pizza deals","description":"Given two pizza slices of different sizes:\r\n\r\n* Slice A with angle alpha1, radius r1, and price p1\r\n* Slice B with angle alpha2, radius r2, and price p2\r\n\r\ncreate a function that compares the two deals and returns\r\n\r\n* 1 if slice A is the better deal\r\n* 2 if slice B is the better deal\r\n* 0 if they are both equally good deals.","description_html":"\u003cp\u003eGiven two pizza slices of different sizes:\u003c/p\u003e\u003cul\u003e\u003cli\u003eSlice A with angle alpha1, radius r1, and price p1\u003c/li\u003e\u003cli\u003eSlice B with angle alpha2, radius r2, and price p2\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ecreate a function that compares the two deals and returns\u003c/p\u003e\u003cul\u003e\u003cli\u003e1 if slice A is the better deal\u003c/li\u003e\u003cli\u003e2 if slice B is the better deal\u003c/li\u003e\u003cli\u003e0 if they are both equally good deals.\u003c/li\u003e\u003c/ul\u003e","function_template":"function p = pizza_comp(alpha1, r1, p1, alpha2, r2, p2)\r\n%if 1 better deal than 2\r\np = 1;\r\n%if 2 better deal than 1\r\np = 2;\r\n%equally good deals\r\np = 0;\r\nend","test_suite":"%%\r\nalpha1 = 30;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 15;\r\np1 = 1.5;\r\np2 = 1.4;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 1;\r\nassert(isequal(p, p_correct));\r\n\r\n%%\r\nalpha1 = 30;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 17;\r\np1 = 1.5;\r\np2 = 1.3;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 2;\r\nassert(isequal(p, p_correct));\r\n\r\n%%\r\nalpha1 = 28;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 16;\r\np1 = 1.28-3.1250e-04;\r\np2 = 1.17;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 0;\r\nassert(isequal(p, p_correct));","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":42,"test_suite_updated_at":"2016-12-07T18:26:38.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T22:07:37.000Z","updated_at":"2026-04-14T13:26:02.000Z","published_at":"2016-10-24T22:07:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two pizza slices of different sizes:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSlice A with angle alpha1, radius r1, and price p1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSlice B with angle alpha2, radius r2, and price p2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecreate a function that compares the two deals and returns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 if slice A is the better deal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 if slice B is the better deal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 if they are both equally good deals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43109,"title":"How many complete pizzas (number 2)","description":"x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\r\n\r\nExample:\r\n\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\r\n\r\nin the first column we have on slice (x=1) from a pizza  margarita (t=1) cut in half (n=2) -\u003e half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u003e so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u003e1.5 slices margarita pizza.\r\n\r\nso we can combine this to 2 pizza  margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.","description_html":"\u003cp\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\u003c/pre\u003e\u003cp\u003ein the first column we have on slice (x=1) from a pizza  margarita (t=1) cut in half (n=2) -\u0026gt; half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u0026gt; so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u0026gt;1.5 slices margarita pizza.\u003c/p\u003e\u003cp\u003eso we can combine this to 2 pizza  margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.\u003c/p\u003e","function_template":"function y = completePizzas(x,n,t)\r\n  y = x;\r\nend","test_suite":"%%%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 1 1];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 1 2];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 3];\r\ny_correct = 1;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 58 41 24 7 5];\r\n n = [2 6 8  50 5 4 3];\r\n t = [1 2 3  1  4 2 3];\r\ny_correct = 15;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":94929,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2016-10-21T17:41:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T08:13:26.000Z","updated_at":"2026-04-14T14:06:29.000Z","published_at":"2016-10-06T08:13:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 3 12];\\n n = [2 6 8];\\n t = [1 2 1];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein the first column we have on slice (x=1) from a pizza margarita (t=1) cut in half (n=2) -\u0026gt; half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u0026gt; so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u0026gt;1.5 slices margarita pizza.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso we can combine this to 2 pizza margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":748,"title":"Wrapping the Tower of Pisa","description":"The famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\r\n\r\nNote: inspired on problem 167","description_html":"\u003cp\u003eThe famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\u003c/p\u003e\u003cp\u003eNote: inspired on problem 167\u003c/p\u003e","function_template":"function y = paperneed(s,a)\r\n  y = s;\r\nend","test_suite":"%%\r\ns = pi;\r\na = pi^2;\r\ny_correct = 2*pi^4 + pi^3;\r\nassert(abs(paperneed(s,a)-y_correct)\u003c1e-12)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":4638,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":302,"test_suite_updated_at":"2012-06-06T20:53:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-05T11:41:10.000Z","updated_at":"2026-02-18T21:57:01.000Z","published_at":"2012-06-05T11:41:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe famous artist Christo Vladimirov Javacheff, who likes pizza, wants to wrap the well-known Italian tower in paper. It is a circular tower with radius s [m] and height a [m] and he decided to neglect the fact that it was leaning. How many square meters of paper should he bring as a minimum? Don't forget the top, although it is not so nice!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote: inspired on problem 167\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43108,"title":"How many complete pizzas","description":"x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\r\n\r\nExample:\r\n\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n\r\nin the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u003e half a pizza.\r\nin the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u003e so half a pizza.\r\nin the third column we have 12 slices of a pizzas cut in 8 slices -\u003e1.5 slices.\r\n\r\nThis combines to 2.5 pizzas, so we have 2 complete pizzas!","description_html":"\u003cp\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e x = [1 3 12];\r\n n = [2 6 8];\u003c/pre\u003e\u003cp\u003ein the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u0026gt; half a pizza.\r\nin the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u0026gt; so half a pizza.\r\nin the third column we have 12 slices of a pizzas cut in 8 slices -\u0026gt;1.5 slices.\u003c/p\u003e\u003cp\u003eThis combines to 2.5 pizzas, so we have 2 complete pizzas!\u003c/p\u003e","function_template":"function y = completePizzas(x,n)\r\n  y = x;\r\nend","test_suite":"%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n%%\r\n x = [1 3 7];\r\n n = [2 6 8];\r\ny_correct = 1;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n%%\r\n x = [2 3 12];\r\n n = [2 6 8];\r\ny_correct = 3;\r\nassert(isequal(completePizzas(x,n),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":94929,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2016-10-19T11:42:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T07:55:59.000Z","updated_at":"2026-02-17T14:21:36.000Z","published_at":"2016-10-06T07:55:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut. How many complete pizzas do we have?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 3 12];\\n n = [2 6 8];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein the first column we have on slice (x=1) from a pizza cut in half (n=2) -\u0026gt; half a pizza. in the second column we have 3 slices (x=3) from a pizza cut in 6 slices (n=6) -\u0026gt; so half a pizza. in the third column we have 12 slices of a pizzas cut in 8 slices -\u0026gt;1.5 slices.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis combines to 2.5 pizzas, so we have 2 complete pizzas!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":167,"title":"Pizza!","description":"Given a circular pizza with radius z and thickness a, return the pizza's volume. [ z is first input argument.]\r\nNon-scored bonus question: Why is the function interesting?","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 102.5px 8px; transform-origin: 102.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a circular pizza with radius\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.5px 8px; transform-origin: 3.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ez\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.5px 8px; transform-origin: 45.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and thickness\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 88px 8px; transform-origin: 88px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return the pizza's volume. [\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.5px 8px; transform-origin: 3.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ez\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 74px 8px; transform-origin: 74px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is first input argument.]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 190px 8px; transform-origin: 190px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eNon-scored bonus question: Why is the function interesting?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = pizza(z,a)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('pizza.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || ...\r\n          contains(filetext, 'if') || contains(filetext, 'switch'); \r\nassert(~illegal)\r\n\r\n%%\r\nz = 1;\r\na = 1;\r\nv_correct = pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 2;\r\na = 1;\r\nv_correct = 4*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 1;\r\na = 2;\r\nv_correct = 2*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n\r\n%%\r\nz = 2;\r\na = 2;\r\nv_correct = 8*pi;\r\nassert(isequal(pizza(z,a),v_correct))\r\n","published":true,"deleted":false,"likes_count":372,"comments_count":313,"created_by":39,"edited_by":223089,"edited_at":"2022-12-19T07:41:42.000Z","deleted_by":null,"deleted_at":null,"solvers_count":23804,"test_suite_updated_at":"2022-12-19T07:41:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-29T16:17:01.000Z","updated_at":"2026-04-13T22:53:58.000Z","published_at":"2012-01-29T16:21:23.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a circular pizza with radius\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ez\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and thickness\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return the pizza's volume. [\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ez\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is first input argument.]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNon-scored bonus question: Why is the function interesting?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44743,"title":"Pizza order","description":"A pizza order by phone in diameter d1, pizza will be make only in diameter d2.\r\nReturn the pizza pieces p should be make.(pizza can be cut into quarter)\r\n\r\n* for example: \r\n\r\n# di = 2, d2 = 1, p = 4\r\n# di = 1, d2 = 2, p = 0.25\r\n# di = 5, d2 = 7, p = 0.75\r\n","description_html":"\u003cp\u003eA pizza order by phone in diameter d1, pizza will be make only in diameter d2.\r\nReturn the pizza pieces p should be make.(pizza can be cut into quarter)\u003c/p\u003e\u003cul\u003e\u003cli\u003efor example:\u003c/li\u003e\u003c/ul\u003e\u003col\u003e\u003cli\u003edi = 2, d2 = 1, p = 4\u003c/li\u003e\u003cli\u003edi = 1, d2 = 2, p = 0.25\u003c/li\u003e\u003cli\u003edi = 5, d2 = 7, p = 0.75\u003c/li\u003e\u003c/ol\u003e","function_template":"function p = Pizza2(d1,d2)\r\n  p = 1;\r\nend","test_suite":"%%\r\nd1 = 2;d2 = 1;\r\nn_correct = 4;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 1;d2 = 2;\r\nn_correct = 0.25;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 5;d2 = 7;\r\nn_correct = 0.75;\r\nassert(isequal(Pizza2(d1,d2),n_correct))\r\n\r\n%%\r\nd1 = 7;d2 = 5;\r\nn_correct = 2;\r\nassert(isequal(Pizza2(d1,d2),n_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":82229,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-10-10T08:58:25.000Z","updated_at":"2026-04-14T15:23:09.000Z","published_at":"2018-10-10T08:58:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA pizza order by phone in diameter d1, pizza will be make only in diameter d2. Return the pizza pieces p should be make.(pizza can be cut into quarter)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 2, d2 = 1, p = 4\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 1, d2 = 2, p = 0.25\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edi = 5, d2 = 7, p = 0.75\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43615,"title":"pizza deals","description":"Given two pizza slices of different sizes:\r\n\r\n* Slice A with angle alpha1, radius r1, and price p1\r\n* Slice B with angle alpha2, radius r2, and price p2\r\n\r\ncreate a function that compares the two deals and returns\r\n\r\n* 1 if slice A is the better deal\r\n* 2 if slice B is the better deal\r\n* 0 if they are both equally good deals.","description_html":"\u003cp\u003eGiven two pizza slices of different sizes:\u003c/p\u003e\u003cul\u003e\u003cli\u003eSlice A with angle alpha1, radius r1, and price p1\u003c/li\u003e\u003cli\u003eSlice B with angle alpha2, radius r2, and price p2\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ecreate a function that compares the two deals and returns\u003c/p\u003e\u003cul\u003e\u003cli\u003e1 if slice A is the better deal\u003c/li\u003e\u003cli\u003e2 if slice B is the better deal\u003c/li\u003e\u003cli\u003e0 if they are both equally good deals.\u003c/li\u003e\u003c/ul\u003e","function_template":"function p = pizza_comp(alpha1, r1, p1, alpha2, r2, p2)\r\n%if 1 better deal than 2\r\np = 1;\r\n%if 2 better deal than 1\r\np = 2;\r\n%equally good deals\r\np = 0;\r\nend","test_suite":"%%\r\nalpha1 = 30;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 15;\r\np1 = 1.5;\r\np2 = 1.4;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 1;\r\nassert(isequal(p, p_correct));\r\n\r\n%%\r\nalpha1 = 30;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 17;\r\np1 = 1.5;\r\np2 = 1.3;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 2;\r\nassert(isequal(p, p_correct));\r\n\r\n%%\r\nalpha1 = 28;\r\nalpha2 = 40;\r\nr1 = 20;\r\nr2 = 16;\r\np1 = 1.28-3.1250e-04;\r\np2 = 1.17;\r\np = pizza_comp(alpha1, r1, p1, alpha2, r2, p2);\r\np_correct = 0;\r\nassert(isequal(p, p_correct));","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":42,"test_suite_updated_at":"2016-12-07T18:26:38.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T22:07:37.000Z","updated_at":"2026-04-14T13:26:02.000Z","published_at":"2016-10-24T22:07:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two pizza slices of different sizes:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSlice A with angle alpha1, radius r1, and price p1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSlice B with angle alpha2, radius r2, and price p2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecreate a function that compares the two deals and returns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 if slice A is the better deal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2 if slice B is the better deal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e0 if they are both equally good deals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43109,"title":"How many complete pizzas (number 2)","description":"x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\r\n\r\nExample:\r\n\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\r\n\r\nin the first column we have on slice (x=1) from a pizza  margarita (t=1) cut in half (n=2) -\u003e half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u003e so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u003e1.5 slices margarita pizza.\r\n\r\nso we can combine this to 2 pizza  margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.","description_html":"\u003cp\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\u003c/pre\u003e\u003cp\u003ein the first column we have on slice (x=1) from a pizza  margarita (t=1) cut in half (n=2) -\u0026gt; half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u0026gt; so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u0026gt;1.5 slices margarita pizza.\u003c/p\u003e\u003cp\u003eso we can combine this to 2 pizza  margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.\u003c/p\u003e","function_template":"function y = completePizzas(x,n,t)\r\n  y = x;\r\nend","test_suite":"%%%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 1];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 1 1];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 1 2];\r\ny_correct = 2;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 12];\r\n n = [2 6 8];\r\n t = [1 2 3];\r\ny_correct = 1;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n%%\r\n x = [1 3 58 41 24 7 5];\r\n n = [2 6 8  50 5 4 3];\r\n t = [1 2 3  1  4 2 3];\r\ny_correct = 15;\r\nassert(isequal(completePizzas(x,n,t),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":94929,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2016-10-21T17:41:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T08:13:26.000Z","updated_at":"2026-04-14T14:06:29.000Z","published_at":"2016-10-06T08:13:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ex is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 3 12];\\n n = [2 6 8];\\n t = [1 2 1];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein the first column we have on slice (x=1) from a pizza margarita (t=1) cut in half (n=2) -\u0026gt; half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -\u0026gt; so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices -\u0026gt;1.5 slices margarita pizza.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso we can combine this to 2 pizza margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"pizza\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"pizza\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"pizza\"","","\"","pizza","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007faf332529e0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007faf33252940\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007faf33251e00\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007faf33252d00\u003e":1,"#\u003cMathWorks::Search::Field:0x00007faf33252c60\u003e":50,"#\u003cMathWorks::Search::Field:0x00007faf33252bc0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007faf33252b20\u003e":"tag:\"pizza\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007faf33252b20\u003e":"tag:\"pizza\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"pizza\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"pizza\"","","\"","pizza","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007faf332529e0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007faf33252940\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007faf33251e00\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007faf33252d00\u003e":1,"#\u003cMathWorks::Search::Field:0x00007faf33252c60\u003e":50,"#\u003cMathWorks::Search::Field:0x00007faf33252bc0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007faf33252b20\u003e":"tag:\"pizza\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007faf33252b20\u003e":"tag:\"pizza\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":748,"difficulty_rating":"easy"},{"id":43108,"difficulty_rating":"easy"},{"id":167,"difficulty_rating":"easy"},{"id":44743,"difficulty_rating":"easy-medium"},{"id":43615,"difficulty_rating":"easy-medium"},{"id":43109,"difficulty_rating":"easy-medium"}]}}