2022年8月2日

摘要: 题目描述: 思路:用结构体来存储学生信息,自定义一下比较函数重载<,然后直接用sort来排序就可 上代码: #include<bits/stdc++.h> using namespace std; const int N=1010; int n; struct student{ string nam 阅读全文
posted @ 2022-08-02 22:09 jessamineyy 阅读(45) 评论(0) 推荐(0)

2022年1月15日

摘要: 首先,我们来理一遍题意,第一行输入n是整数序列长度,且整数值小于N,第二行为整数序列A1~An,f(x)是序列中小于等于x的整数里最大的数的下标。我们需要计算的是sum=f(0)+f(1)+...+f(N-1)。 本来没什么思路,但一看到样例解释,这不就是前缀和+差分嘛! 用样例1来解释一下思路: 阅读全文
posted @ 2022-01-15 22:30 jessamineyy 阅读(682) 评论(3) 推荐(1)

导航