飞行棋 嫅朑磃淥(解题思路) 我们来进行分类讨论: 当 i < d i<d i<d 时 设期望 s s s 次扔到点 1 1 1 ,那么有: s = d − 2 d − 1 ( s + 1 ) + 1 d − 1 s=\frac{d-2}{d-1}(s+1)+\frac{1}{d-1} s=d−1d−2(s+1)+d−11 解得: s = d − 1 s=d-1 s=d
购物 卪惖㐌熝(解题思路) 每 k + 1 k+1 k+1 个商品就会有一个免费,剩下的没个 x x x 元,代进去即可。 code #include<iostream>#include<cstdio>using namespace std;int T;int n,k,x;int main(){cin>>T;while(T--){cin>>n>>k>>x;cout<<(
圆盘 解题思路 这道题是一道 最小表示法 ,两两枚举圆盘并比较后就可以做到优秀的 O ( n m 2 log 2 m + n 2 m ) O(nm^2\log_2m+n^2m) O(nm2log2m+n2m) code #include<iostream>#include<cstdio>#include<algorithm>using namespace std;i
Problem Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list’s nodes, only nodes itself may be changed. Example1 Given 1
Problem Given the head of a linked list, remove the nth node from the end of the list and return its head. Constraints: The number of nodes in the list is sz.1 <= sz <= 300 <= Node.val <= 1001 <= n
捡石头 解题思路 贪心。我们存储每一个编号的两个节点的位置,求相邻两个编号的两个节点分别的差。有两种情况,我们取 min \min min 即可,即: a n s + = m i n ( a b s ( a [ i ] [ 1 ] − a [ i + 1 ] [ 1 ] ) + a b s ( a [ i ] [ 2 ] − a [ i + 1 ] [ 2 ] ) , a b
2020.10技术报告 本月工作进展论文整理Investigating the Effects of Self-Avatars and Story-Relevant Avatars on Children's Creative Storytelling调查方法- 度量写作理解能力(writing apprehension measure):- 创造性的自我效能感(Creative self-