Algorithm3

\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcase\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mscores\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmap\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0mavg\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msum\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mscores\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mscores\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[0mcnt\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mscore\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mscores\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mTypeError\u001b[0m: 'int' object is not callable" ] } ], "source": [ "case = int(input())\n", "result = []\n", "\n", "for i in range(case):\n", " scores = list(map(int, input().split()))\n", " avg = sum(scores[1:]) / scores[0]\n", " cnt = 0\n", " for score in scores:\n", " if score > avg:\n", " cnt = cnt + 1\n", " result.append(round(cnt / scores[0] * 100, 3))\n", " \n", "for i in result:\n", " print(\"%.3f\" %i + \"%\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "c = int(input())\n", "avg = []\n", "\n", "for _ in range(c):\n", " n = list(map(int, input().split()))\n", " cnt = 0\n", " sum = 0\n", " \n", " for i in range(n[0]):\n", " sum += n[i+1]\n", " \n", " for i in range(n[0]):\n", " if n[i + 1] > (sum / n[0]):\n", " cnt += 1\n", " \n", " avg.append((cnt / n[0]) * 100)\n", " n.clear()\n", "\n", "for i in range(c):\n", " print(\"%.3f\" %avg[i] + \"%\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 15596\t์ •์ˆ˜ N๊ฐœ์˜ ํ•ฉ" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def solve(a):\n", " return sum(a)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4673\t์…€ํ”„ ๋„˜๋ฒ„" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "origin = set(range(1, 10001))\n", "selfNumber = set()\n", "\n", "for i in range(1,10001):\n", " temp = i\n", " for j in str(i):\n", " temp += int(j)\n", " selfNumber.add(temp)\n", "selfNumber = list(origin - selfNumber)\n", "selfNumber.sort()\n", "for i in selfNumber:\n", " print(i)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \t1065\tํ•œ์ˆ˜" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ " 1000\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "144\n" ] } ], "source": [ "case = int(input())\n", "cnt = 99\n", "\n", "if case < 100:\n", " print(case)\n", "else:\n", " for i in range(100, case + 1):\n", " temp = list(map(int, str(i)))\n", " if temp[0] - temp[1] == temp[1] - temp[2]:\n", " cnt +=1\n", " print(cnt)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }