摘要:
A 统计单词数 题解 注意是否是单词。 CODE CPP #include<iostream> #include<string> #include<algorithm> using namespace std; int main() { string word, article; getline(c 阅读全文
摘要:
# A. Gift Carpet ### 题意 最近,特马和维卡庆祝了家庭日。他们的朋友 Arina 送给他们一块地毯,这块地毯可以用拉丁文小写字母的$n \cdot m$表来表示。 维卡还没看过礼物,但特马知道她喜欢什么样的地毯。如果维卡能在地毯上读出自己的名字,她一定会喜欢的。她从左到右逐列阅读 阅读全文
摘要:
# A. Not a Substring ### 题解 对于这个题,我们可以考虑两种可能的连续的子串: - 有两个及以上的相同的字符,比如`(((`,`()))`,那么我们就需要尽可能地构造出连续不相同的字符串,比如`()()()`就非常符合我们的要求,每一对都不一样。 - 有两个及以上的不相同的字 阅读全文
摘要:
# A - First ABC ## 题意 给一个长度为N的仅由ABC三个字符组成的字符串S,问S中ABC三个字符第一次出现的位置的最大值。 ## 题解 使用`map`判重,记录当前不同的字符串的个数`cnt`,当`cnt`等于3时,输出此时的下标+1作为答案。 ## Code ```cpp #in 阅读全文
摘要:
假设硬币的面值为$c^0, c^1, ..., c^k$,其中c是一个大于1的整数,k是一个大于等于1的整数。设$a_i$是找n分钱的最优解中面值$c^i$的硬币的数量,那么对于$i=0,1,...,k-1$,有$a_i < c$。这是因为如果$a_i >= c$,那么可以用一个面值$c^{i+1} 阅读全文
摘要:
link Code // #include <bits/stdc++.h> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> 阅读全文
摘要:
link Code // #include <bits/stdc++.h> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> 阅读全文
摘要:
link Code // #include <bits/stdc++.h> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> 阅读全文
摘要:
link Code // #include <bits/stdc++.h> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> 阅读全文
摘要:
洛谷-2652 key 思路 有个mod k的想法很好,然后就是对于一遍一遍的询问进行前缀和优化,但有个问题就是算出来的s矩阵最开始是个下三角矩阵,但是根据前缀和公式来看,s[i][j]上方的s[i - 1][j]就是空的,而不是我们需要的值,所以要在第i行结束时,对s[i][i + 1]进行特别赋 阅读全文