{"id":15055980,"url":"https://github.com/innofang/quantify","last_synced_at":"2025-05-16T11:32:55.123Z","repository":{"id":129983673,"uuid":"93168619","full_name":"InnoFang/Quantify","owner":"InnoFang","description":"📐 A desktop application practice and powered by JavaFx. (Curriculum design for algorithm)","archived":false,"fork":false,"pushed_at":"2020-06-26T14:13:35.000Z","size":305,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T01:11:19.508Z","etag":null,"topics":["algorithm","algorithm-design","curriculum-design","curriculum-project","javafx","javafx-application","javafx-desktop-apps","quantify","quantization"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InnoFang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T13:34:04.000Z","updated_at":"2020-11-15T15:13:44.000Z","dependencies_parsed_at":"2023-05-06T11:31:39.085Z","dependency_job_id":null,"html_url":"https://github.com/InnoFang/Quantify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnoFang%2FQuantify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnoFang%2FQuantify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnoFang%2FQuantify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnoFang%2FQuantify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InnoFang","download_url":"https://codeload.github.com/InnoFang/Quantify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254522542,"owners_count":22085147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithm-design","curriculum-design","curriculum-project","javafx","javafx-application","javafx-desktop-apps","quantify","quantization"],"created_at":"2024-09-24T21:47:29.922Z","updated_at":"2025-05-16T11:32:52.095Z","avatar_url":"https://github.com/InnoFang.png","language":"Java","readme":"# Quantify\n\nAlgorithm Design\n\nEnglish | [中文](https://github.com/InnoFang/Quantify/blob/master/README_zh.md)\n\n# Description\n\nThe quantization process represents a wide range of values ​​as a small range of approximations, thus achieving lossy compression. For example: 16-bit JPG file into a 4-color GIF file, is to RGB color space color quantification into four colors of the process. In addition, four students who are 161,164,178,184 are represented as \"one of the 160-169 stages, one in the 170-179 stage and one in the 180th stage\" is also quantified.\nIt is necessary to quantize the sequence of natural numbers less than 1000 into a sequence of s natural numbers. There are many ways to quantify, for example, only two numbers for the sequence {1 2 3 4 5 6 7 8 9 10}, can be expressed as {3 3 3 3 7 7 7 7 7}. Or can also be expressed in the form of {1 1 1 1 10 10 10 10 10}. What is the quantification result of the sum of the squares of the numerical errors?\n\nFor example, the sequence {1 2 3 4 5} is quantified to {2 2 3 3 3}, and the error after quantization is -1,0,0,1,2. Then the sum of the squared errors is 1 + 0 + 0 + 1 + 4 = 6. However, if the quantization becomes {2 2 4 4 4}, then the sum of the squares of errors is 1 + 0 + 1 + 0 + 1 = 3. Then write the program, use s values ​​to quantify the sum of the sum of the squares after the given sequence.\n\n## Input\n\nThe first row enters the number of test cases C (1 \u003c= C \u003c= 50). The length n (1 \u003c= n \u003c= 100) of the first line of the test cases and the number of available values ​​s (1 \u003c= s \u003c= 10). The second line enters the n integer of the sequence, and all the numbers of the sequence are natural numbers below 1000.\n\n## Output\n\nEach test case will output the sum of the minimum squares generated when the given sequence is quantized with s values in one row.\n\n# Example\n\n## Input\n\n```\n2\n10 3\n3 3 3 1 2 3 2 2 2 1\n9 3\n1 744 755 4 897 902 890 6 777\n```\n\n## Output\n\n```\n0\n651\n```\n\n# Code\n\n + [_C++_](https://github.com/InnoFang/Quantify/blob/master/code/quantify.cpp)\n + [_Java_](https://github.com/InnoFang/Quantify/blob/master/code/Quantify.java)\n\n# GUI\n\n ![case1](https://cdn.jsdelivr.net/gh/innofang/quantify/image/case1.png)\n \u0026nbsp;\n \u0026nbsp;\n ![case2](https://cdn.jsdelivr.net/gh/innofang/quantify/image/case2.png)\n \n\n# LICENSE\n\n [Apache License 2.0](https://github.com/InnoFang/Quantify/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnofang%2Fquantify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnofang%2Fquantify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnofang%2Fquantify/lists"}