SRM 551 Div1

Topcoder SRM551 Div 1 1000:SweetFruits(矩阵树+容斥) 题解: 考虑枚举哪几个水果是甜的。 发现如果枚举的数量一样,那么对答案的贡献也一样。那么可以根据枚举数量来一起处理。 枚举完数量kkk之后,甜与半甜的不连边,然后跑矩阵树,得到小等于kkk的甜的水果的生成树数量。 因为之前的已经处理过,直接减掉就好。 注意减去的时候要减去组合数,因为这k个中任意组合都会被统计。 之后问题变为了数量kkk, 值小等于vvv的个数,这个直接折半就行了。 ... 阅读详情

noip d2t3 没清数组实力滚粗,赶紧做一波SRM 冷静一下。。。。

250pts

最终答案里至少有一个点没改变位置。因此枚举没改变位置的点,然后把两边和他同色的点移过来的花费排个序,从小到大往里加,直到超过最大花费,更新一下答案。

#include <bits/stdc++.h>
using namespace std;
int n,top,cnt,sum,ans;
int st[110];
class ColorfulChocolates
{
public:
    int maximumSpread(string s,int m)
    {
        n=s.size();
        for(int i=0;i<n;i++)
        {
            top=0;cnt=0;
            for(int j=i-1;j>=0;j--)
                if(s[j]==s[i])
                    st[++top]=i-j-cnt-1,cnt++;
            cnt=0;
            for(int j=i+1;j<n;j++)
                if(s[j]==s[i])
                    st[++top]=j-i-cnt-1,cnt++;
            sort(st+1,st+1+top);
            sum=0;int j=0;
            for(j=1;j<=top;j++)
            {
                if(sum+st[j]>m)break;
                sum+=st[j];
            }
            ans=max(ans,j);
        }   
        return ans;
    }
}cls;

450pts

第一次见到450的题。
就是一个最短路,如果map[i][j]==′Y′那么i到j有一条长度为∑k<jmap[i][k]==′Y′的边,然后跑0到n-1的最短路。

#include <bits/stdc++.h>
using namespace std;
int f[55],inq[55],n,inf;
queue<int>q;
class ColorfulWolves
{
public:
    int getmin(vector<string> s)
    {
        n=s.size();
        memset(f,0x3f,sizeof(f));
        inf=f[0];inq[0]=1;f[0]=0;
        q.push(0);
        while(!q.empty())
        {
            int tmp=q.front();q.pop();
            int cnt=0;inq[tmp]=0;
            for(int i=0;i<n;i++)
                if(s[tmp][i]=='Y')
                {
                    if(f[tmp]+cnt<f[i])
                    {
                        f[i]=f[tmp]+cnt;
                        if(!inq[i])
                            q.push(i),inq[i]=1;
                    }
                    cnt++;
                }
        }
        return f[n-1]==inf ? -1:f[n-1];
    }
}cls;

1000pts

感觉这题还是挺强的。。。
大概看到40左右的数据就要想meet in the middle呀
考虑枚举最终真甜的个数k,然后第一步是求k个甜的水果,甜度和<=最大甜度 的方案数。这个可以用meet in the middle做,复杂度O(2n/2∗n)
然后求最后得到k个真甜的树的个数。可以用矩阵树定理。真甜的和真甜的,真甜的和不甜的,半甜的和不甜的,不甜的和不甜的连无向边。然后跑矩阵树定理。
不过这样跑出来是小于等于k个真甜的树的个数。
用小于k个真甜的所有容斥一下就行了。

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
vector<int>v1[21],v2[21];
int n,m,ans,top;
int way[51],mp[51][51],du[51],tree[51],C[51][51],st[51];
int get(int x,int y,int mx)
{
    int ret=0;
    if(x>n/2||y>n-n/2)return 0;
    for(int i=0,j=v2[y].size()-1;i<v1[x].size();i++)
    {
        while(j>=0&&v2[y][j]+v1[x][i]>mx)j--;
        ret=(ret+j+1)%mod;
    }
    return ret;
}
void ade(int x,int y)
{
    du[x]++;du[y]++;
    mp[x][y]=mp[y][x]=mod-1;
}
int qpow(int x,int y)
{
    int ret=1;
    while(y)
    {
        if(y&1)ret=(ll)ret*x%mod;
        x=(ll)x*x%mod;y>>=1;
    }
    return ret;
}
int solve(int n)
{
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        int pos=-1;
        for(int j=i;j<n;j++)
            if(mp[j][i])pos=j;
        if(pos==-1)return 0;
        if(pos!=i)cnt++;
        for(int j=0;j<n;j++)
            swap(mp[pos][j],mp[i][j]);
        for(int j=i+1;j<n;j++)
            if(mp[j][i])
            {
                int t=(ll)qpow(mp[i][i],mod-2)*mp[j][i]%mod;
                for(int k=i;k<n;k++)
                    mp[j][k]=(mp[j][k]-(ll)mp[i][k]*t%mod+mod)%mod;
            }
    }
    int ret=1;
    for(int i=0;i<n;i++)
        ret=(ll)ret*mp[i][i]%mod;
    return cnt&1 ? mod-ret:ret;
}
class SweetFruits
{
public:
    int countTrees(vector<int>val,int mx)
    {
        n=val.size();
        for(int i=0;i<=n;i++)C[i][0]=1;
        for(int i=1;i<=n;i++)
            for(int j=0;j<=i;j++)
                C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
        for(int i=0;i<n;i++)
            if(val[i]!=-1)st[top++]=val[i];
        for(int i=0;i<1<<(top/2);i++)
        {
            int cnt=0,sum=0;
            for(int j=0;j<top/2;j++)
                if(i>>j&1)cnt++,sum+=st[j];
            v1[cnt].push_back(sum);
        }
        for(int i=0;i<1<<(top-top/2);i++)
        {
            int cnt=0,sum=0;
            for(int j=0;j<(top-top/2);j++)
                if(i>>j&1)cnt++,sum+=st[j+top/2];
            v2[cnt].push_back(sum);
        }
        for(int i=0;i<=n/2;i++)
            sort(v1[i].begin(),v1[i].end());
        for(int i=0;i<=n-n/2;i++)
            sort(v2[i].begin(),v2[i].end());
        for(int i=0;i<n;i++)
            if(val[i]!=-1)m++;
        for(int i=0;i<=m;i++)
        {
            for(int j=0;j<=i;j++)
                way[i]=(way[i]+get(j,i-j,mx))%mod;
            memset(mp,0,sizeof(mp));
            memset(du,0,sizeof(du));
            for(int j=0;j<i;j++)
            {
                for(int k=j+1;k<i;k++)ade(j,k);
                for(int k=m;k<n;k++)ade(j,k);
            }
            for(int j=i;j<m;j++)
                for(int k=m;k<n;k++)ade(j,k);
            for(int j=m;j<n;j++)
                for(int k=j+1;k<n;k++)ade(j,k);
            for(int j=0;j<n;j++)mp[j][j]+=du[j];
            tree[i]=solve(n-1);
            for(int j=0;j<i;j++)
                tree[i]=(tree[i]-(ll)tree[j]*C[i][j]%mod+mod)%mod;
            ans=(ans+(ll)tree[i]*way[i]%mod)%mod;
        }
        return ans;
    }
}cls;
Topcoder SRM 100 场计划 SRM 550 Div1 250 按题意模拟,注意判断边界是否被访问时,以后的路径不能算上 SRM 550 Div1 500 一道找规律题,打个表 SRM 550 Div1 1000 矩阵快速幂题,每个位置是该位置需要多少次才能转到目标态,先让他转到目标态的贡献减去之后,剩下就只剩下自己转圈的贡献了,我们发现这样的贡献在每个位置都相同,就可以算出最大旋转次数. 然后状态就是 有多少个需要两步到... 阅读详情

相关推荐

扣子(coze)案例^第22期:零代码打造小红书竞品监控系统+AI自动生成运营策略建议

本文详细介绍了如何利用扣子(coze)平台零代码搭建小红书竞品监控系统。该系统通过自动化工作流抓取竞品笔记数据,并存入飞书多维表格,结合AI能力自动生成包含可视化分析报告在内的运营策略建议,帮助运营者高效进行数据驱动的市场分析。

weixin_29313239的博客 1005

SRM551 Div1 Medium

Colorful Wolves 题意: 有一只狼可以把自己的颜色在nnn种颜色之间切换,每次切换需要花费一天的时间,颜色编号为0∼n−10∼n−10∼n−1,给定n×nn×nn×n的由'Y'′Y′′Y′和'N'′N′′N′组成的字符矩阵colormapcolormapcolormap,colormap[i][j]='Y'colormap[i][j]=′Y′colormap[i][j]=′Y...

Caristra的博客 559

提示词驱动的多智能体协作系统

《提示词驱动的多智能体协作系统》 关键词:人工智能、多智能体系统、协作机制、提示词驱动、系统设计与应用 摘要:本文深入探讨提示词驱动的多智能体协作系统,首先介绍其背景和核心概念,然后详细分析多智能体系统的基本原理和提示词驱动的协作机制,最

AI天才研究院 851

[矩阵树定理 容斥 meet in middle] Topcoder SRM 551 DIV1 Hard. SweetFruits

枚举最后的树中有多少个是truly sweet的 答案就是 ∑i=0nfi×gi \sum_{i=0}^n f_i\times g_i 其中,fif_i 表示选出 ii 个水果使其价值和不超过Limit的方案数 gig_i 是有 ii 个truly sweet的生成树个数fif_i 可以meet in middle 设图中前 ii 个点是truly sweet, i+1i+1 到 kk 是s

CE玩家 712

MISRA C 详解 · 专栏06:2023 与 2025 更新总览(相对 2012 的差异)

本专栏 01~05 篇基于(143 规则 + 16 指令)。这六年间标准又前进了两步——(大改)和(微调)。本文补充说明「相对 2012,标准变在哪」,并给出新增规范的代表性示例。

XavierKong的博客 73

【ComfyUI专栏】ComfyUI 数字人方案-ComfyUI-EchoMimic

EchoMimic是一个基于图片和语音的数字人生成方案,通过ComfyUI节点实现。该方案安装简单,需下载特定模型文件(Unet、AudioProcessor和VAE)并保存本地。相比其他数字人生成方案,其节点操作更简便,支持多种Pose姿态选择,并能结合视频内容进行姿态同步,通过音频同步口型实现动态内容创建。生成的数字人效果直观,适用于快速创建个性化数字形象。

技术与管理的平衡木- 464

srm 551

资瓷点此阅读QvQ250Description题意:一个长度最多5050的字符串,每次操作可以交换相邻的两个字符,问,经过最多MaxSwapsMaxSwaps次交换之后,最多能让多少个相同的字符连起来Solution枚举一个字符,让其他字符往这里即可,取最小即可Code#include <bits/stdc++.h> using namespace std; #define pb push_back

mlzmlz95的专栏 471

在 ABAP 环境中构建自定义健康监控指标:面向 SAP Cloud ALM 与 SAP Focused Run 的完整实践

本文介绍了在ABAP环境中开发自定义健康监控指标的方法。主要内容包括:1)标准监控指标的不足,如无法反映业务应用层面的问题;2)自定义监控架构,通过metric provider定义指标,由采集作业周期性获取数据并存储;3)核心实现技术,包括IF_GSM_API_PROVIDER接口和三个关键方法;4)指标从ABAP推送到SAP Cloud ALM/Focused Run的完整流程;5)开发实践步骤,从业务分析到具体实现。该方案可帮助团队监控业务关键指标,提升系统运维能力。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 263

SRM551

1.ColorfulBricks #include #include using namespace std; class ColorfulBricks { public: int countLayouts(string bricks) { int a[26],cnt=0; memset(a,0,sizeof(a)); int sz = bricks.size(

da_fan_shu_的专栏 402

计算机实战分享3:森林火灾预测分析可视化机器学习预测-完整数据代码-可直接运行

计算机实战分享3:森林火灾预测分析可视化机器学习预测-完整数据代码-可直接运行

604

openclaw本地模型对接

使用是官方推荐的一种集成方式,它可以简化配置过程。但由于您的系统环境和之前复杂的配置历史,我为您梳理了一个核心流程,并增加了关键的“事后检查”步骤,以确保能从根本上解决问题。

suny8的专栏 2463

【矩阵树定理+容斥】Topcoder SRM 551 DIV1 Hard SweetFruits (TC12141)

【前言】 吐槽一下TC的交代码,在SRMs的练习模式那里交每提交一次分数上限会少一点,于是根本不知道过没过。在VJ上交才知道过了。 当然可能是我太菜了。 【题目】 Topcoder 给定nnn个权值,要么非负,要么为−1-1−1,你现在可以用n−1n-1n−1条边连接这些权值得到一棵树。我们称一个权值是有用的当且仅当它它和至少一个非负权值相连且它本身不为负,这棵树的权值为所有有用的权值之和。 求有...

MEET YOU FIRST TIME 338

maxim max96712+max96717调试笔记

mxxim max96712 和max96717调试笔记

libuping2023的博客 1万+

[meet in middle 矩阵树定理 容斥原理] SRM 551 div1 SweetFruits

集训队论文传送门大概就是我们先用meet in middle求出有恰好k个真甜的方案数 然后我们求这些东西的生成树个数 乘在一起的和就是答案 我们让真甜连真甜 真甜连不甜 假甜连不甜 不甜连不甜 跑一发矩阵树定理 这样只能保证这些真甜的某个子集是真甜 那么我们需要用 0~k-1 的简单容斥一下// BEGIN CUT HERE #include<conio.h> #include<sstr

雯舞 755

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[容斥原理][Meet-in-middle][Matrix-Tree定理] SRM551 Div1 Hard SweetFruits

SolutionSolutionSolution 将原问题分成两个子问题。 从所有甜的水果中选出kkk个水果作为真甜的,要求他们甜度之和不超过maxSweetnessmaxSweetnessmaxSweetness的方案数cntkcntkcnt_k 令nnn为甜的水果数目,求出组成的树的方案数treektreektree_k使得nnn个甜的水果中恰有kkk个水果为真甜的。 ans=∑k=0...

Vectorxj的博客 632

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

TC SRM 551 div2 题解

转载请注明出处,谢谢 http://blog.youkuaiyun.com/ACM_cxlove?viewmode=contents           by---cxlove 终于在TC过了两题,可惜第三题看错了题目。 250pt:只需要判断有几种颜色即可。 class ColorfulBricks{ public: int countLayouts(string bricks){ bool

窝不是爱酱,喵~~~~ 2361

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

SRM 551 DIV2

250pt 题意:   给定字符串,求使至多有一对相邻字符不同的排列数。 分析:   至多有一对就说明至多只有两种字符,答案只可能是0(多于两种字符),1(一种字符),2(两种字符)。 View Code #include <cstdlib> #include <cctype> #include <cstring&g...

dasu9538的博客 124

PTA刷题避坑指南:为什么你的‘支票面额’C程序会超时?

本文深入分析了PTA平台上'支票面额'C程序超时的常见原因,包括逻辑运算符误用、循环范围错误和缺少提前终止机制。通过详细的调试技巧和优化方案,帮助编程初学者避免类似错误,提升刷题效率。文章特别强调了PTA刷题中的关键注意事项和实用调试方法。

weixin_33747129的博客 305

【TopCoder SRM 551 Div2】Solutions

【250】   Beaver Bindu has some colored bricks. Each color is described by an uppercase letter. Bricks of each color all look exactly the same. You are given a string bricks. Each character of bricks r...

weixin_33928137的博客 173

SRM 551 div2

错过了。。。当练习做的。 250pt 略   500pt 怎么开始就没敢写暴力呢。。。。看别人的思路,挺巧妙的。Orz class ColorfulChocolates { public: int maximumSpread(string c, int m) { int l = c.length(), i, j, num, cnt; i...

weixin_34253539的博客 105

TC SRM551 DIV2 500 ColorfulChocolates 暴力

题目大意:给一个由A-Z组成的字符串,最大转换maxSwaps次,问连续相同字符串最多多少。 代码: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #includ

小白滴acm之路 533

SRM 551 div2 950(DP, 环形+优化)

题意: 把n个蛋糕(最多3种颜色)按1…n放成一圈。 要求相邻的蛋糕颜色不同,求有多少种放法。 思路: f[i][j][k][first][last]f[i][j][k][first][last] 表示A, B, C各有i, j, k且第一个是first, 最后一个位last的方法数。 边界: i+j+k = 1, return 1 i+k+j = 2, return first =

slowlight93的专栏 608
上一篇: bzoj 4296 [PA2015]Mistrzostwa 宽搜 并查集
下一篇: hdu5307 He is Flying FFT
make_it_for_good
博客等级 码龄11年 13粉丝 183原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值