{"action":"opened","issue":{"url":"https://api.github.com/repos/chken007/HankC/issues/2","labels_url":"https://api.github.com/repos/chken007/HankC/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/chken007/HankC/issues/2/comments","events_url":"https://api.github.com/repos/chken007/HankC/issues/2/events","html_url":"https://github.com/chken007/HankC/issues/2","id":65789258,"number":2,"title":"Lame Code needs to be Modified. ","user":{"login":"chken007","id":11699993,"avatar_url":"https://avatars.githubusercontent.com/u/11699993?v=3","gravatar_id":"","url":"https://api.github.com/users/chken007","html_url":"https://github.com/chken007","followers_url":"https://api.github.com/users/chken007/followers","following_url":"https://api.github.com/users/chken007/following{/other_user}","gists_url":"https://api.github.com/users/chken007/gists{/gist_id}","starred_url":"https://api.github.com/users/chken007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chken007/subscriptions","organizations_url":"https://api.github.com/users/chken007/orgs","repos_url":"https://api.github.com/users/chken007/repos","events_url":"https://api.github.com/users/chken007/events{/privacy}","received_events_url":"https://api.github.com/users/chken007/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-01T22:06:08Z","updated_at":"2015-04-01T22:06:08Z","closed_at":null,"body":"多项式加法（5分）\r\n题目内容：\r\n一个多项式可以表达为x的各次幂与系数乘积的和，比如：\r\n\r\n现在，你的程序要读入两个多项式，然后输出这两个多项式的和，也就是把对应的幂上的系数相加然后输出。\r\n程序要处理的幂最大为100。\r\n\r\n输入格式:\r\n总共要输入两个多项式，每个多项式的输入格式如下：\r\n每行输入两个数字，第一个表示幂次，第二个表示该幂次的系数，所有的系数都是整数。第一行一定是最高幂，最后一行一定是0次幂。\r\n注意第一行和最后一行之间不一定按照幂次降低顺序排列；如果某个幂次的系数为0，就不出现在输入数据中了；0次幂的系数为0时还是会出现在输入数据中。\r\n\r\n输出格式：\r\n从最高幂开始依次降到0幂，如：\r\n2x6+3x5+12x3-6x+20\r\n注意其中的x是小写字母x，而且所有的符号之间都没有空格，如果某个幂的系数为0则不需要有那项。\r\n\r\n输入样例：\r\n6 2\r\n5 3\r\n3 12\r\n1 6\r\n0 20\r\n6 2\r\n5 3\r\n2 12\r\n1 6\r\n0 20\r\n输出样例：\r\n4x6+6x5+12x3+12x2+12x+40\r\n\r\n\r\n\r\n\r\nCode: \r\n\r\n\r\n\r\nimport java.util.Scanner;\r\n\r\npublic class HelloWorld {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner in = new Scanner(System.in);\r\n\t\tint[] powers = new int[101];\r\n\t\tint i, a;\r\n\t\ti = in.nextInt();\r\n\t\ta = in.nextInt();\r\n\t\tfor(int j = 0; j < 2 ; j++)      \\\\ Two Polynomial Adds\r\n\t\t{\r\n\t\t\tif(j == 1)\r\n\t\t\t{\r\n\t\t\t\ti = in.nextInt();\r\n\t\t\t\ta = in.nextInt();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\twhile(i < 0 || i >100)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"Please re-enter the number here: \");\r\n\t\t\t\ti = in.nextInt();\r\n\t\t\t\ta = in.nextInt();\r\n\t\t\t}\r\n\t\t\twhile(i != 0 )  \\\\ Read the number; \r\n\t\t\t{\r\n\t\t\t\tpowers[i] += a;\r\n\t\t\t\ti = in.nextInt();\r\n\t\t\t\ta = in.nextInt();\r\n\t\t\t}\r\n\t\t\tpowers[i] += a;\r\n\t\t\t\r\n\t\t}\r\n\t\tfor(int j = 100; j > 0 ; j--)\r\n\t\t{\r\n\t\t\tif(powers[j] != 0 )\r\n\t\t\t{\r\n\t\t\t\tSystem.out.print(powers[j] + \"X\"+ j + \"+\" );\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.print(powers[0]);\r\n\t}\r\n}\r\n\r\n\r\n\r\n"}}