{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n 每学期的期末,大家都会忙于计算自己的平均成绩,这个成绩对于评奖学金是直接有关的。国外大学都是计算GPA(grade point average) 又称GPR(grade point ratio),即成绩点数与学分的加权平均值来代表一个学生的成绩的。那么如何来计算GPA呢? \n \u003cbr\u003e \n \u003cbr\u003e一般大学采用之计分法 \n \u003cbr\u003e \n \u003cbr\u003eA90 - 100 4 点 \n \u003cbr\u003eB80 - 89 3 点 \n \u003cbr\u003eC70 - 79 2 点 \n \u003cbr\u003eD60 - 69 1 点 \n \u003cbr\u003eE0 - 59 0 点 \n \u003cbr\u003e \n \u003cbr\u003e例如:某位学生修习三门课,其课目、学分及成绩分别为: \n \u003cbr\u003e英文:三学分、92 分;化学:五学分、80 分;数学:二学分、60分,则GPA的算法如下: \n \u003cbr\u003e \n \u003cbr\u003e科目\u0026nbsp;学分\u0026nbsp;分数\u0026nbsp;点数\u0026nbsp;学分×点数\u0026nbsp; \n \u003cbr\u003e英文\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;92\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;4\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;12 \n \u003cbr\u003e化学\u0026nbsp;\u0026nbsp;5\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;80\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;15 \n \u003cbr\u003e数学\u0026nbsp;\u0026nbsp;2\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;60\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;1\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;2 \n \u003cbr\u003e合计\u0026nbsp;\u0026nbsp;10\u0026nbsp;\u0026nbsp;\u0026nbsp;29 \n \u003cbr\u003e29/10\u003d2.9 \n \u003cbr\u003e2.9即为某生的GPA \n \u003cbr\u003e下面有请你写一个用于计算GPA的程序。 \n \u003cbr\u003e \n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"包含多组数据,每组数据的第一行有一个数N,接下来N行每行表示一门成绩。每行有两个实型的数 s,p,s表示这门课的学分,p表示该学生的成绩(百分制)。如果p\u003d-1则说明该学生这门课缺考,是不应该计算在内的。 \n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"对每组数据输出一行,表示该学生的GPA,保留两位小数。如果GPA不存在,输出-1。 \n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3\n3 92\n5 80\n2 60\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e2.90\u003c/pre\u003e"}}]}