1371:最小的K个数 http://ac.jobdu.com/problem.php?pid=1371 题意 输入n个整数,找出其中最小的K个数。 思路 排序然后输出。 代码 #include<stdio.h>#include<algorithm>#define N 200005using namespace std;int main(){ int n
递归法(Python) # Definition for a binary tree node.# class TreeNode:# def __init__(self, val=0, left=None, right=None):# self.val = val# self.left = left# self.right = r
答案: #include <stdio.h> int main() {int m = 0;scanf("%d", &m); // 读取测试实例的个数 while (m--) //循环m次{int n = 0, i = 0;scanf("%d", &n); // 读取求和项数n double sum = 0.0;for (i = 1; i <= n; i++) //分母从1开始