https://www.luogu.com.cn/problem/P5401 对于一个合法的方案,令$c_i$表示颜色$i$出现的次数则有 \(\sum\limits_{i=1}^D \lfloor c_i / 2 \rfloor \ge m\) \(\sum\limits_{i=1}^{D} (c ...
分类:
其他好文 时间:
2020-06-26 14:48:38
阅读次数:
38
7-1 Happy Numbers (20分) A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the s ...
分类:
移动开发 时间:
2020-06-26 14:26:29
阅读次数:
90
题目链接:https://codeforces.ml/contest/1360/problem/G 题意:在一个n行m列的矩阵中 问是否存在每行有a个1 每列有b个1的矩阵 思路:首先判断能否能放 如果能放的话 要构造的话就要考虑贪心的构造 列和行同时考虑的话很难做 那么考虑首先满足每一行放a个1 ...
分类:
其他好文 时间:
2020-06-26 14:21:33
阅读次数:
53
解释:把数组的每个数字相加 代码: 1 static int Sum2(int[] a, int lo, int hi) 2 { 3 if (lo==hi) 4 { 5 return a[lo]; 6 } 7 int mi = (lo + hi) / 2; 8 return Sum2(a, lo, ...
分类:
编程语言 时间:
2020-06-26 14:17:58
阅读次数:
90
题目链接:小猫爬山 解法一: #include<iostream> #include<algorithm> using namespace std; const int N = 20; int n,m; int cat[N],sum[N]; int ans=N; void dfs(int now,i ...
分类:
编程语言 时间:
2020-06-26 10:50:34
阅读次数:
99
基本参考照抄于AKrry's blog 建议先阅读复数入门 引理:欧拉公式 \(e^{i\theta}=\cos \theta +i \sin \theta\) 证明: 将$e^{i\theta}$泰勒展开: \(e^{i\theta}=\sum \limits_{j=0}^{\infty} \df ...
分类:
其他好文 时间:
2020-06-26 10:37:30
阅读次数:
76
1.操作符概览 下面图中的优先级是从上往下递减,同行是从左往右递减。 操作符的本质就是函数(算法);比如说没有操作符+,那么我们做加法的时候只能先写一个Add方法,然后调用。 操作符不能脱离与它相关联的数据类型; 比如下面的代码: int a=1; int b=2; int c=a/b; c的结果一 ...
给定一个下标从0开始的数列,
最多旋转一次子数列(将某一段子数列倒置),
问所有偶数位置上的元素和的最大值。 ...
分类:
其他好文 时间:
2020-06-26 10:22:12
阅读次数:
216
#i和i的运行分析 今天在刷leetcode的三数之和时,写错i与i。一直只能搜索到一个解,遂百度,发现一个有趣的问题。 int a=0; int a=a++; cout<<a; 结果不是1,而是0!!!。看到一篇博客(链接忘了)阐明的原理,大概如下: ##i++ type tmp=i; i=i+1 ...
分类:
其他好文 时间:
2020-06-26 01:41:24
阅读次数:
75
代码: <script> //默認值的用法 /* function log(x, y) { y = y || "word"; console.log(x, y); } log("hello"); */ /* function add(...values) { let sum = 0; for (le ...
分类:
其他好文 时间:
2020-06-25 23:40:47
阅读次数:
47