题解列表

筛选

2821: 开关灯

摘要:解题思路:注意事项:参考代码:N,M = map(int,input().split())  lights = [1] * N  # 初始化列表  1为开,-1为关 closed = [] fo……

铺地毯(二维差分)(内存超限)

摘要:解题思路: 最优解应该是逆序查找,但是这道题也可以用二维差分来做,每次把铺地毯的区域加1,最后的数字就是最上层的地毯编号,区间修改可以使用二分差分来实现,最后查找目标格的数字既是此格的地毯编号。(但……

数学方法逆序对

摘要:解题思路:有n的阶层种情况 然后所有情况都存在的话逆序对和非逆序对是一比一全部的情况为Cn2  = n*(n-1)/2*1 最终结果n! * Cn2 / 2 注意事项:取模我搞不太懂参考代码:n = ……

不要想太多,这样简单

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int x,i,s=1;    scanf("%d",&x);    for(i=2;i<x/2;i++)……

二维列表+Python特性

摘要:解题思路:获取下标,找到对应的已经存好地数据注意事项:A0——A9是10个数,向下取整可直接用int()参考代码:s=int(input()[1]) m,n=1189,841 result=[]……

3125: 局域网(net)

摘要:```cpp #include #include using namespace std; const int N=101,inf=0x3f3f3f3f; int n,m,mapp[N][N……

做过水仙花数的凑鼠鼠一个

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int n){    int sum=0,t=n;    while(t)    {        sum+=(t%10)*……

3127: 联络员(liaison)

摘要:```cpp #include #include using namespace std; struct node { int from,to,dis; friend b……