随笔分类 - 刷题-Codeforces
摘要:A题 "ConneR and the A.R.C. Markland N" 题解: 在当前点左右对称的尝试走即可
        阅读全文
                
摘要:A题 Distinct Digits 题解: 暴力水题 1 #include<bits/stdc++.h> 2 using namespace std; 3 int f[10]; 4 bool judge(int x) 5 { 6 memset(f,0,sizeof(f)); 7 while(x){
        阅读全文
                
摘要:A. Circle of Students 找到最小值,左右试探后,找到连续的一串序列持续输出前进,直到回到原来位置,或中途退出 1 #include<bits/stdc++.h> 2 #define FOR(i,a,b) for(int i=a;i<b;i++) 3 #define FOR2(i,
        阅读全文
                
摘要:A 完全k叉树 题意 已知完全$k$叉树有$n$个节点,求树上两个最远点的距离,节点之间的距离均为1。 基本思路 求树的深度$h$,则满$k$叉树的两点距离为$(h 1) 2$,对剩余一层的节点数$rest$做判断,若$rest k^{h 1}/k$则ans+2,否则若$rest 0,ans+1$ 
        阅读全文
                
摘要:A题 原CF 438D The Child and Sequence 题意 给一串数字,m次操作,1.区间查询;2.区间取模;3.单点修改 基本思路 考虑到模如果大于区间的最大值,则取模没有意义。若小于则向下查询并修改,考虑到一个数每次取模最多为原数的$1/2$,则可认为修改次数不超过$\log{2
        阅读全文
                
摘要:A题 DIY Wooden Ladder 签到题,求n 2和第二大的最小值 c++ include define FOR(i,a,b) for(int i=a;i n m k; for(int i=1;i arr[i]; } FOR(i,0,20)f[i]=0; f[0]= k; for(int i
        阅读全文
                
摘要:A题 Drinks Choosing 判断奇偶 c++ include using namespace std; int arr[2000]; int main() { int n,k;cin n k;int rem=0; for(int i=0;i num;arr[num]++; } for(in
        阅读全文
                
摘要:基本思路 $$ \begin{array}{l} k,n,a,b,假设能完成游戏,则有\\ x_1+x_2=n\\ x_1 a+x_2 b using namespace std; typedef long long ll; ll q,k,n,a,b; int main() { cin q; whi
        阅读全文
                
摘要:补题 原CF 1141F Graph Without Long Directed Paths 基本思路 染色问题,u和v记录边的两个顶点,dfs遍历。 有个问题是若边数=顶点数,为什么不能直接输出 1? c++ include using namespace std; typedef struct{
        阅读全文
                
摘要:原CF 1138A Sushi for Two 基本思路 每个状态之和之前的一个连续状态有关,并且取下限即可,若状态发生改变,计数器置零 c++ include using namespace std; int main() { int n;cin n;int num1=0,num2=0,sum=0
        阅读全文
                
摘要:前面考试周,抱歉拖了这么久。 A题 Alex and a Rhombus 基本思路 递推解决,n=1时,Count(1)=1;n 1时,Count(n)=Count(n 1)+(n 1) 4 c++ include using namespace std; int num[100005]; int 
        阅读全文
                
摘要:[toc] A题 基本思路: 假设n个学生开始字母相同,则分成n/2和n n/2两对的配对数最少 c++ include using namespace std; int main() { int n;cin n;int a[26]={0}; for(int i=0;i s; a[s[0] 'a']
        阅读全文
                

浙公网安备 33010602011771号