很简单的题 #include<bits/stdc++.h> using namespace std; #define N 200005 #define ll long long ll x[N],n,m; map<ll,int>mp; vector<ll>ans; struct Node{ ll po ...
分类:
其他好文 时间:
2020-01-06 21:22:05
阅读次数:
152
数学专题测试1:T1 exLucas板子 不会就没什么好说的T2 50pts 异或FWT板子 不会就没什么好说的 满分做法:先把原序列变成点值表达式,然后点值比较好的性质是可以直接运算。 问题等价于求$ans=\sum\limits_{i=0}^{p} x^{2^i}$,然后注意到模数很小,直接倍增 ...
分类:
其他好文 时间:
2020-01-05 14:07:00
阅读次数:
78
题目大意 输入点数为N一棵树 求树上长度恰好为K的路径个数 输入格式 第一行两个数字N,K,如题意 接下来的N?1行中,每行两个整数u,v表示一条树边(u,v) 输出格式 一个整数ans,如题意 直接套模板,没啥好说的 ...
分类:
其他好文 时间:
2020-01-02 22:47:00
阅读次数:
74
1 #include <iostream> 2 #include <vector> 3 #include <string> 4 using namespace std; 5 int main(){ 6 vector<string> ans[1001]; 7 int length[1000] = {0 ...
分类:
其他好文 时间:
2020-01-01 13:39:33
阅读次数:
77
#include<stdio.h> #include<iostream> #include<vector> using namespace std; int n,p,k; int facMaxSum = -1; vector<int>preData,ans,tmpAns; int power(int ...
分类:
其他好文 时间:
2019-12-30 23:20:17
阅读次数:
80
class Solution { public: int movesToMakeZigzag(vector<int>& nums) { //判断每个位置 i 对于它的前后 i-1 和 i+1 需要减少多少 //按照奇偶分类保存 int ans[2]={0}; for(int i=0; i<nums. ...
分类:
编程语言 时间:
2019-12-30 11:32:19
阅读次数:
66
题意 给出一棵树,对于k=1\~n求最大点集S满足dis(i,j)=k或k+1(i,j∈S & i≠j) 题解 首先答案满足ans[i] =ans[i+2],因此可以维护后缀 分类讨论 ①k=1 最大点集为最大度数+1 ②k为奇数 考虑一个中心点u,那么点集S满足任意一个在S中的点到u的距离为(k ...
分类:
其他好文 时间:
2019-12-29 22:00:22
阅读次数:
102
题目描述: 方法一:O(N) class Solution: def findNumbers(self, nums: List[int]) -> int: ans=0 for num in nums: if len(str(num))%2==0: ans+=1 return ans 方法二:数学 O ...
分类:
其他好文 时间:
2019-12-25 20:43:12
阅读次数:
85
题目:https://nanti.jisuanke.com/t/41412思路:dfs 先取ai>2 2^12>3000 因此至多取11个 其余用1补 (3000*2)-(3000+2)=2998 那么需要加入2998个1 正好3000位 所以 3000是ai最大取值 计算ans时 有重复元素的排列 ...
分类:
其他好文 时间:
2019-12-24 14:05:18
阅读次数:
83
12/19-12/26 python 1 # -*- coding: utf-8 -*- 2 3 import sys 4 ans = [1,2,3,4,5,6] 5 6 def operate(fun): 7 8 a = ans[0] 9 b = ans[1] 10 c = ans[2] 11 d ...
分类:
其他好文 时间:
2019-12-24 13:58:58
阅读次数:
65