C. Vlad and a Sum of Sum of Digits 分析 在给定的数据规模下,可以直接暴力计算出每个数的数位之和,求出前缀和后就可以在O(1)的时间复杂度下返回答案,因为数位拆分的时间复杂度为O(nlogn),所以总的时间复杂度为O(nlogn+t),其中t为查询次数。
C. Vlad and a Sum of Sum of Digits 题解 输入不保证所有n的和,只能预处理出每个数字的数位和并求其前缀和,O(1)回答每次询问。 实现 #include <iostream> #include <vector> #define endl '\n' using namespace std; const int N = 2e5; vector<int> s(N + 1, 0); void init(int n) { ...
C. Vlad and a Sum of Sum of Digits思路:这个题就是预处理一下数字,因为本题的限制是0.5s,所以我们不能每次都去找数字,只能一次性做好,再用O(1)的时间去查询,但是我一开始预处理时候用的字符串方式也超时了,这里我把字符串代码也粘贴出来,希望大家给出意见...
A. Vlad and the Best of Five 题意: 给定一个长度为5的只包含A和B的字符串,问哪个字符个数多。 思路: 模拟。遍历统计判断。 代码实现: #include<bits/stdc++.h>#define bug(x) cout<<#x<<"=="<<x<<endl;#define endl "\n"#define fi first#define se second#define ull unsigned long longus...
1660B-VladAndCandies.cpp 1660C-GetAnEvenString.cpp 1661A-ArrayBalancing.cpp 1661B-GettingZero.cpp 1663A-WhoTested.cpp 1663B-MikesSequence.cpp 1663C-PojaVerdon.cpp 1663D-IsItRated3.cpp 1665A-GCDvsLCM.cpp 1665B-ArrayCloningTechnique.cpp 1668A-DirectionChange.cpp 1668B-SocialDistance.cpp 1669...
1926C-VladAndASumOfSumOfDigits.cpp 1926D-VladAndDivision.cpp 1927A-MakeItWhite.cpp 1927B-FollowingTheString.cpp 1927C-ChooseTheDifferentOnes.cpp 1927D-FindTheDifferentOnes.cpp 1927E-KleverPermutation.cpp 1928A-RectangleCutting.cpp 1928B-Equalize.cpp 1929A-SashaAndTheBeautifulArray.cpp 1929B-Sasha...
And finally people who were the first to solve each problem: ProblemCompetitorPenalty A vintage_Vlad_Makeev 0:01 B Dalgerok 0:04 C kmjp 0:12 D KenMuse 0:13 E AkshajK 0:10 F AnotherRound 0:07 G danya.smelskiy 0:26 UPD: Editorial is outAnnouncement of Educational Codeforces Round...
vladburac 10 months ago, # ^ | +6 Another idea for B is to split the problem regarding the X-axis and the Y-axis and take the minimum out of the specific coordinates for the axis and add it to the answer if both are walking in the same direction. (after you've made A the ...
C - Vlad and a Sum of Sum of Digits 连续写下n数字:1,2,3,...,n,并将每个数字替换为其数位和 一眼前缀和,直接算1到2e5的前缀和即可(拆数位加和是否会超时?过完机再试) 最差复杂度O(5*n)(五位数拆五次),随便过 #include<bits/stdc++.h>#define yes cout<<"SQUARE"<<endl#define no cout...
1660B-VladAndCandies.cpp 1660C-GetAnEvenString.cpp 1661A-ArrayBalancing.cpp 1661B-GettingZero.cpp 1663A-WhoTested.cpp 1663B-MikesSequence.cpp 1663C-PojaVerdon.cpp 1663D-IsItRated3.cpp 1665A-GCDvsLCM.cpp 1665B-ArrayCloningTechnique.cpp 1666D-DeletiveEditing.cpp 1667A-MakeItIncreasing.cpp 166...