Codeforces Round #234 (Div. 2) <全>

用FPGA在HDMI上显示自定义字符:从COE文件到OSD叠加的保姆级教程 本文详细介绍了如何在FPGA上实现HDMI视频流的OSD字符叠加技术,从COE文件生成到动态区域控制的完整流程。通过Verilog代码示例和实战技巧,帮助开发者掌握字符ROM设计、像素坐标追踪和动态混合等核心技术,适用于视频监控、系统状态显示等应用场景。 阅读详情

CF 400A. Inna and Choose Options

题目链接:
http://codeforces.com/problemset/problem/400/A

题目意思:
给只含‘X'和’O'字符的长度为12的字符串,将它写入矩阵a*b(a*b=12)中,问存在某一列全为‘X'的矩阵的个数。

解题思路:
枚举。一共只有1*12,2*6,3*4,4*3,6*2,12*1六种。

代码:

//#include<CSpreadSheet.h>

#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define ll __int64
#define LL long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
//#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;

char save[25];
int a[10]={0,1,2,3,4,6,12}; //保存六种情况
vector<int>myv;

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int t;

   scanf("%d",&t);
   while(t--)
   {
       myv.clear();
       scanf("%s",save+1);

       int ans=0;

       for(int i=1;i<=6;i++)
       {
           int aa=a[i];
           int bb=12/a[i];

           bool flag=false;

           for(int j=1;j<=bb;j++)
           {
               bool tt=true;
               for(int k=1;k<=aa;k++)
               {
                   if(save[(k-1)*bb+j]!='X')
                   {
                       tt=false;
                       break;
                   }
               }
               if(tt)
               {
                   flag=true;
                   break;
               }

           }
           if(flag)
           {
               ans++;
               myv.push_back(a[i]);//保存结果集
           }
       }
       printf("%d ",ans);
       for(int i=0;i<myv.size();i++)
            printf("%dx%d ",myv[i],12/myv[i]);
       putchar('\n');


   }
   return 0;
}






CF 400B. Inna and New Matrix of Candies

题目链接:

http://codeforces.com/contest/400/problem/B

题目意思:

给n*m的方格,每行中都且仅有一个方格含S和G,每一步可以使所有的G向右移,只到发生下列情况:1、某个G已到了最后一列。2、某个G已到了S。求把所有的G已到S需要的最少的步数。

解题思路:

统计S-G差出现的个数。

代码:

//#include<CSpreadSheet.h>

#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define ll __int64
#define LL long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
//#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;

#define Maxn 1100

char save[Maxn][Maxn];
int n,m;
int gap[Maxn];

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   while(~scanf("%d%d",&n,&m))
   {
       bool flag=true;

       memset(gap,0,sizeof(gap));

       for(int i=1;i<=n;i++)
       {
           scanf("%s",save[i]+1);
           int g,s;
           for(int j=1;j<=m;j++)
           {
               if(save[i][j]=='G')
                    g=j;
               else if(save[i][j]=='S')
                    s=j;

           }
           if(g>s)
                flag=false;
           else
                gap[s-g]++;

       }

       if(!flag)
       {
           printf("-1\n");
           continue;
       }
       int ans=0;

       for(int i=1;i<=m;i++)
            if(gap[i])
                ans++;
       printf("%d\n",ans);
   }
   return 0;
}

CF 400C C. Inna and Huge Candy Matrix

题目链接:

http://codeforces.com/problemset/problem/400/C

题目意思:

给一个矩阵,求经过顺时针旋转90度x次,左右翻转y次,逆时针旋转90度z次,坐标(x,y)对应的新坐标。

解题思路:

上面三种变换可以统一成几个简单的基本操作。详细可以参考我的这篇博客:http://blog.youkuaiyun.com/cc_again/article/details/18007891

这题相对比较简单,可以先对x%=4,y%=2,z=(4-z%4)%4(转化成顺时针的情况),然后对于每个坐标,分别实行上述操作,即可得到答案。

代码:

//#include<CSpreadSheet.h>

#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define ll __int64
#define LL long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
//#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;

int n,m;
int tempn,tempm;

void C90(int &x,int &y) //顺时针旋转90度
{
    int temp=x;

    x=y;
    y=tempn-temp+1;

    swap(tempn,tempm);
}
void hh(int &x,int &y) //左右翻转
{
    y=tempm-y+1;
}
int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int x,y,z,p;

   while(~scanf("%d%d",&n,&m))
   {
       scanf("%d%d%d%d",&x,&y,&z,&p);
       x=x%4; //顺时针的次数
       z=(4-z%4)%4; //转化为顺时针的次数
       y=y%2; //左右翻转

       for(int i=1;i<=p;i++)
       {
           int a,b;

           scanf("%d%d",&a,&b);
           tempn=n,tempm=m;

           for(int i=1;i<=x;i++)
                C90(a,b);
           if(y)
               hh(a,b);

           for(int i=1;i<=z;i++)
               C90(a,b);
           printf("%d %d\n",a,b);



       }

   }

   return 0;
}

CF 400 D D. Dima and Bacteria

题目链接:

http://codeforces.com/problemset/problem/400/D

题目意思:

这题意思有点搞人,有k种细菌,第i种有ci个,按顺序编号,一共有n个细菌。告诉细菌之间传递能量所需的价值。问是否存在对于任何种类i,该种所有细菌相互传递能量的价值都为0(可以传递)。存在就输出Yes,并输出任意两种细菌传递能量的最小值,否则只用输出No.

解题思路:

floyd+并查集+二分

如果价值为零,则添加到一个集合里,如果同种的细菌的fa相同,则说明该种细菌之间传递价值都为0。

对于不同种类的细菌,更新种类之间传递的最小值,用floyd求出任意两种之间的能量传递最小值。

sum[i]:保存第i种细菌的最后一个细菌编号,二分可以求出属于第几种细菌。

代码:

//#include<CSpreadSheet.h>

#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define ll __int64
#define LL long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
//#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;

#define Maxn 110000
#define Maxm 550

int sum[Maxn],save[Maxm];
int n,m,k;
int fa[Maxn],dis[Maxm][Maxm];

void init()
{
    for(int i=1;i<=n;i++)
        fa[i]=i;
    memset(dis,INF,sizeof(dis));
    for(int i=1;i<=k;i++)
        dis[i][i]=0;
}

int find(int x)
{
    if(fa[x]!=x)
       return  fa[x]=find(fa[x]);
    return x;
}
int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   while(~scanf("%d%d%d",&n,&m,&k))
   {
       init();
      sum[0]=0;

      for(int i=1;i<=k;i++)
      {
          scanf("%d",&save[i]);
          sum[i]=sum[i-1]+save[i];
      }

      for(int i=1;i<=m;i++)
      {
          int a,b,c;
          int fa_a,fa_b,loc_a,loc_b;

          scanf("%d%d%d",&a,&b,&c);
          loc_a=lower_bound(sum+1,sum+k+1,a)-sum; //求出该细菌所属种类
          loc_b=lower_bound(sum+1,sum+k+1,b)-sum;


          if(loc_a!=loc_b) //说明不是同一种
             dis[loc_a][loc_b]=dis[loc_b][loc_a]=min(dis[loc_a][loc_b],c);

          if(c==0)
          {
              fa_a=find(a);
              fa_b=find(b);

              if(fa_a!=fa_b)
                  fa[fa_b]=fa_a;
          }



      }
      bool ans=true;

      for(int i=1;i<=k;i++)
      {
          int temp=find(sum[i-1]+1); //该种第一个细菌所在集合
          bool flag=true;

          for(int j=sum[i-1]+2;j<=sum[i];j++) //
          {
              if(find(j)!=temp)
              {
                  flag=false;
                  break;
              }
          }
          if(!flag)
          {
              ans=false;
              break;
          }
      }
      if(!ans)
      {
          printf("No\n");
          continue;
      }
      printf("Yes\n");
      for(int p=1;p<=k;p++) //floyd
            for(int i=1;i<=k;i++)
              {
                  for(int j=1;j<=k;j++)
                  {
                      if(dis[i][p]+dis[p][j]<dis[i][j])
                          dis[i][j]=dis[j][i]=dis[i][p]+dis[p][j];
                  }
              }
      for(int i=1;i<=k;i++)
      {
          for(int j=1;j<=k;j++)
          {
              if(dis[i][j]==INF)
                    printf("-1 ");
              else
                    printf("%d ",dis[i][j]);
          }
          putchar('\n');
      }


   }
   return 0;
}



CF 400 E E. Inna and Binary Logic

题目链接:

http://codeforces.com/problemset/problem/400/E

题目意思:

给定n个数a1[1..n],定义ak[i]=ak-1[i]&ak-1[i+1],则一共有n*(n-1)/2个数。有m种操作,每种操作ai,bi,表示把a1[ai]改成bi,求这n*(n-1)/2个数的和,改变是连续影响的。

解题思路:

二进制和数据结构。

按位进行处理,mys[i]表示第i位为零是n个数中的哪几个。两个零之间一定是连续的1,扫描开始的n个数,对于每一位如果它为1,则找到大于它的第一个为0的位置,则这个1持续的次数就是他们之间的间隔。这样求出原始的总和。

操作主要分两种:

1、把当前位的0变成1。此时从当前的0到下一个0的间距是该位0所要增加的1的个数p,该零后面的将不受影响。该零前面的所有连续的1(假设为m个)都会增加p个。(从0往左下角45度对角线)故+m*p*位权。

2、把当前位的1变成0。与上述情况相反,-m*p*位权。

注意要连续更新原始数组,中间溢出情况。

代码:

//#include<CSpreadSheet.h>

#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define ll __int64
#define LL long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
//#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;

#define Maxn 110000
set<int>mys[20]; //mys[i]保存第i位为零有哪几个数
int save[Maxn];

int main()
{
    //cout<<(1<<20);
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int n,m;

   while(~scanf("%d%d",&n,&m))
   {
       for(int i=0;i<20;i++)
       {
           mys[i].clear();
           mys[i].insert(0); //边界情况考虑进去
           mys[i].insert(n+1);
       }
       for(int i=1;i<=n;i++)
       {
           scanf("%d",&save[i]);
           for(int j=0;j<20;j++)
           {
               if(!(save[i]&(1<<j)))
                    mys[j].insert(i); //统计j位为0的 哪几个情况
           }

       }
       ll ans=0;

       for(int i=1;i<=n;i++)
       {
           for(int j=0;j<20;j++)
           {
               if(save[i]&(1<<j)) //非零的情况
               {
                   set<int>::iterator it=mys[j].upper_bound(i); //找到大于当前位置的第一个零的位置

                   ans+=(ll)(*it-i)*(1<<j);
               }
           }
       }
       //printf("%I64d\n",ans);
       //system("pause");

       for(int i=1;i<=m;i++)
       {
           int ri,va;

           scanf("%d%d",&ri,&va);

           for(int j=0;j<20;j++)
           {
               if((va&(1<<j))&&((save[ri]&(1<<j))==0)) //要把0改成1
               {
                   set<int>::iterator it=mys[j].find(ri);

                   it++;
                   int rr=*it;
                   it--;
                   it--;
                   int le=*it;

                   ans+=(ll)(rr-ri)*(1<<j)*(ri-le);

                   mys[j].erase(ri);
               }
               else if(((va&(1<<j))==0)&&(save[ri]&(1<<j))) //把1变成0
               {
                   mys[j].insert(ri);
                   set<int>::iterator it=mys[j].find(ri);

                   it++;
                   int rr=*it;
                   it--;
                   it--;
                   int le=*it;

                   ans-=(ll)(rr-ri)*(1<<j)*(ri-le);


               }

           }
           printf("%I64d\n",ans);
           save[ri]=va; //注意连续更新
       }


   }


   return 0;
}





ArcGIS实验教程——实验二十五:大型商场选址经典案例 本实验基于ArcGIS平台进行商场选址分析,综合考虑道路、居民点、停车场和已有商场四个影响因素。通过缓冲区分析建立各要素的影响范围(道路50米、居民点100米、停车场100米、已有商场500米),采用叠加分析中的相交和擦除运算确定最优选址区域。实验建立了区位评价体系,通过属性赋值(1/-1)和联合运算生成综合评价结果,并实现分级可视化显示。注意事项包括距离参数设置对结果的影响以及正确选择空间分析工具。该流程为商业选址提供了科学的GIS解决方案。 阅读详情

相关推荐

【编号326】全国地灾数据全国25万多个地质灾害点空间分布数据

全国地质灾害点分布数据涵盖25万多个各类灾害点信息,为灾害防治提供重要依据。通过分析灾害分布规律,可识别高风险区,指导监测预警、应急避险和基础设施建设。多地成功案例(如湖北兴山崩塌避险、重庆长寿滑坡预警、湖南"挪床行动")证明,提前预警和科学防治能有效避免人员伤亡。云南省2024年通过预警体系成功避让31起灾害,保护1342人生命安全。这些实践表明,地质灾害防治需结合科技手段与群防体系,实现早预警、早处置。

千奇百怪无奇不有 1472

codeforces 234E Champions' League

传送门:http://codeforces.com/problemset/problem/234/E 题目大意:(注意要用文件)有n个队伍,每个队伍都有一个积分,按照积分高低顺序列出4个等级(每个等级n/4个,所以n一定是4的倍数),然后x,a,b,c这4个数就是一个随机数产生器,按照x=(x*a+b)mod c的规则来生成随机数,每生成一个随机数,便把这一个等级里的这个随机数所指向的队伍归类到g

NightRaven的博客 652

深入剖析:功率放大电路设计精髓——从理论到实践

输入信号首先被调制(通常是PWM脉宽调制)成高频开关信号,驱动功率开关管(MOSFET),再通过LC低通滤波器滤除高频分量,还原出放大的音频信号。在靠近功放板电源引脚处放置足够容量的电解电容(如100uF - 1000uF)和高频瓷片电容(如0.1uF)并联进行电源去耦,抑制低频和高频干扰,防止低频振荡(Motorboating)和高频自激。,堪称电子世界里的“能量转换器”。当输入信号在零附近(即两个器件切换导通的区域)时,由于器件的开启电压(Vbe或Vgs)不为零,输出波形会出现明显的衔接不流畅的失真。

Zihan2558的博客 1697

codeforces round #234 div.2 A

codeforces round #234 div.2 A A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ther

x___song的专栏 863

第四篇:关于python程序打包的问题-找不到fsspec

这个问题困扰了我将近两天的时间一直找不到什么好的办法,甚至打算放弃。主要原因是身边没有可以述说的人,也没有可以请教的人。正在想要放弃的时候找到了解决办法。 打包后运行程序是这样的, 大概意思是找不见fsspec这个依赖,刚接触python说实话对于这些第三方库理解不是很到位,我的理解就是:类似于java程序中的jar包,程序找不见了。可怎么让他找见了,刚开始以为我自己没有安装fsspec,在cmd中进行了安装,结果如下图所示 很明显,已经安装并且安装目录都有,跟着网上的一些解决办法,在打包的时候把这.

weixin_47861710的博客 5865

原形网络(Prototypical Networks)基于PyTorch的实现

我在Jay2coomzz的基础上修改了数据处理方式和evaluation_model()方法,作为初学者若有不当之处恳请大家批评指正,原文链接如下: https://blog.csdn.net/weixin_38471579/article/details/102631018 数据集和源码链接将放到评论区 文章目录1 数据集一个简单的数据集介绍数据集处理2 搭建网络CNNProtonets 1 数据集 一个简单的数据集介绍 Omniglot数据集一共包含1623 类手写体,每一类中包含20 个样本。其中.

weixin_43872532的博客 6636

codeforces round 234 DIV2

p1:Inna and Choose Options       模拟,12张牌,每张牌上是X或O,现在可以按每行1,2,3,4,6,12张的方式摆放,若某种摆放方式使得其中任意一列全部是X这就是一种合理的方式,求所有合理的摆放方式。直接模拟... #include #include #include using namespace std; int n,m; char s[20]; v

Broken Wings 833

AD23导出Gerber文件保姆级教程:从PCB到嘉立创下单,一步不落(附常见问题排查)

本文提供AD23导出Gerber文件的详细教程,涵盖从PCB设计检查到嘉立创下单的全流程,特别针对两层板设计场景,帮助新手工程师避免常见错误。内容包括Gerber文件生成步骤、钻孔文件设置、文件检查工具推荐以及嘉立创下单实操指南,确保PCB打样顺利。

weixin_30924239的博客 440

Codeforces Round #234 (Div. 2)

CF回滚以后掉到蓝名了,打了一场勉强回到div1,D最后复测竟然挂了,好伤心。。。 A Inna and Choose Options          长度为12的OX的序列,要排成a×b的矩阵,使得矩阵有一列全为X。很简单。随便枚举一下就行了。。 代码: #include #include #include #include #include #include #include

绝望的乐园 787

从原理到落地:Java+TensorRT打造YOLO模型GPU极致推理方案

Java+TensorRT的YOLO模型GPU加速方案,核心是通过JNI桥接实现Java与TensorRT的高效交互,结合TensorRT的底层优化能力,最大化GPU算力。该方案既保留了Java后端的工程化优势(如易维护、生态完善),又解决了AI模型推理的性能瓶颈,可落地于实时视频分析、智能监控、工业质检等场景。基于TensorRT Dynamic Shape实现多尺寸输入的自适应优化;结合Java的协程(Virtual Thread)提升异步推理的并发效率;

2601_94871597的博客 766

本地通知与健康数据的隐私保护方案

随着移动健康(mHealth)应用的普及,本地通知与健康数据的结合为用户提供了更加个性化的健康管理体验。然而,这种便利性也带来了严峻的隐私保护挑战。本文旨在探讨如何在移动应用中实现本地通知功能的同时,确保用户健康数据的隐私安全。本地通知与健康数据结合的技术架构隐私保护的核心技术方案具体算法实现与数学模型实际应用案例分析本文首先介绍背景知识和核心概念,然后深入探讨隐私保护的技术方案,包括算法原理和数学模型。接着提供实际代码实现和应用场景分析,最后讨论未来发展趋势和挑战。

移动开发前沿的博客 1309

C. Messy(Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3))(思维)

C. Messy(Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3))(思维) Description Input 4 8 2 ()(())() 10 3 ))()()()(( 2 1 () 2 1 )( Output 4 3 4 1 1 5 8 2 2 3 4 10 1 4 6 7 0 1 1...

画船听雨眠 380

自动识别象棋棋子的OpenCV应用

在计算机视觉领域,OpenCV是一个广泛应用的开源计算机视觉库,它提供了丰富的图像处理和分析工具。本文将介绍如何使用OpenCV实现自动识别象棋棋子的功能,并提供相应的源代码。通过以上代码,我们可以实现对棋盘图像中棋子的自动识别。需要注意的是,以上代码只是一个简单的示例,实际应用中可能需要根据具体情况进行参数调整和算法优化,以获得更好的识别效果。函数利用预处理后的图像,寻找图像中的轮廓,并根据轮廓的面积筛选出可能的棋子轮廓,最后在原图像中提取棋子区域。在主程序中,我们读取输入图像,并调用。

WzisTypescript的博客 907

Codeforces Round #234 (Div. 2)(完全)

比赛链接:http://codeforces.com/contest/400/ 代码链接:https://github.com/9974/Codeforces/tree/master/234div2 A, B, C水题 D dfs判联通性+floyd最短路 E  按位拆成线段树,线段树区间合并问题

Nicolas 1445

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Codeforces Round #792 (Div. 1 + Div. 2)

Codeforces Round #792 (Div. 1 + Div. 2)

AC__dream的博客 363

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Codeforces Round #234 (Div. 2) D. Dima and Bacteria

D. Dima and Bacteria time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dima took up the biology of bacteria,

To be what you what to be! 1290

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

【索引】Codeforces Round #234 (Div. 2)

Problem A: Inna and Choose Options(400A) Problem B: Inna and New Matrix of Candies(400B) Problem C: Inna and Huge Candy Matrix(400C) Problem D: Dima and Bacteria(400D) Proble

不慌不忙、不急不躁 868

Codeforces Round #772 (Div. 2) ABC

Problem - A - Codeforces 题目大意:给定一个长度为n的数组a,我们可以选择两个不同的整数i,j(1≤i<j≤n),用x替换ai,用y替换aj(x和y是非负整数)。为了不破坏数组,必须保持ai | aj = x | y,其中|表示按位or运算。 请输出使用上述运算任意次后所能得到的数组的最小和。 input 4 3 1 3 2 5 1 2 4 8 16 2 6 6 3 3 5 6 output 3 31 6 7 从0开始依次进行或运算即可。 ..

qq_51376774的博客 241

Codeforces Round #825 (Div. 2)

就统计一下a数组和b数组的’0’的差值的绝对值,然后再统计a数组和b数组不同数的位置的个数,这个不同位置的个数是一定大于等于’0’的差值的绝对值的,如果相等的话那就是这个数,如果大于的话就是差值绝对值+1就行,下面看代码把。我想的是dp,f[i]表示的是以第i个数为结尾,最左边能扩展到的位置,如果当前的数为a[i],代表它最大能当a[i]个数的数组的最后一个,转移的时候就只看前一个能扩展到什么位置就行,下面看代码吧。将这个序列循环右移之后的结果就是。这不就相当于是两两交换吗。

weixin_51979465的博客 400

Codeforces Round #145 (Div. 2) D. Cinema

题目链接: http://codeforces.com/problemset/problem/234/D D. Cinema input input.txt output output.txt Overall there aremactors in Berland. Each actor has a personal identifier — an integer from1to...

Source_Roc 234

Codeforces Round #145 (Div. 2) C. Weather

题目链接: http://codeforces.com/problemset/problem/234/C C. Weather input input.txt output output.txt Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, s...

Source_Roc 193

Codeforces Round #662 (Div. 2)题解

A. Rainbow Dash, Fluttershy and Chess Coloring time limit per test 1 second memory limit per test 256 megabytes input

狗蛋的博客 780

Codeforces Round #234A

Inna and choose option       题意: 一个由12个字符('O'或'X')组成的字符串,这12个字符可以排列成a*b(a*b=12)的矩阵,要求矩阵某一列都是'X'。用户输入t个字符串,都是由12个'O'或'X组成,设计函数可求解符合要求矩阵的个数,并且将符合要求的矩阵大小输出。 Input: 第一行输入一个整数t(Range:1-100),t表

wuji3390的博客 241

Codeforces Round #234 (Div. 2) 解题报告

Problem A Inna and Choose Options 题意:水题 代码如下: 1 /************************************************** 2 * Author : xiaohao Z 3 * Blog : http://www.cnblogs.com/shu-xiaohao/ 4 * L...

weixin_33851604的博客 81
上一篇: Codeforces Round #232 (Div. 1) <A>
下一篇: Codeforces Round #233 (Div. 1) <A>
Accagain
博客等级 码龄14年 376粉丝 316原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值