Codeforces Round #243 (Div. 2) A,B,C(暴力枚举)

A. Sereja and Mugs

思路: 大水杯的水是累计的..定定要改掉自己读题猴急的毛病!!

CODE:

#include 
#include
#include
#include
using namespace std;

int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        int a[105],s=0;
        for(int i=0;i

B. Sereja and Mirroring

题意: 要求找到给出的数组成像的最小行数..

思路: 将行数除以2 进行匹配, 若对称, 则继续除以2, 直到 不对称或者 行数为奇数为止; 若行数一开始便为奇数 即为答案~

          小技巧: 因为输入的数据仅为0,1 , 则可以吧每行数串都看成二进制~

CODE:

#include
#include
using namespace std;
int a[105][105];
int main()
{
    //freopen("in.in","r",stdio);
    int x,y;
    while(~scanf("%d%d",&x,&y))
    {
        for(int i=0;i=0;j++,i--)
                {
                    for(int k=0;k

CODE2 (使用二进制)

#include
#include
using namespace std;
int main()
{
    int a[105]={0};
    int x,y;
    while(~scanf("%d%d",&x,&y))
    {
        int n;
        for(int i=0;i=0;i--,j++)
                {
                    if(a[i]!=a[j])
                    {
                        ok=0;break;
                    }
                    if(!ok) break;
                }
                if(x%2==1&&ok)
                {
                    printf("%d\n",x);
                    break;
                }
            }
            if(!ok)printf("%d\n",x*2);
        }
    }
    return 0;
}

  C. Sereja and Swaps

题意:找到和最大的连续子序列,输出和

思路: 暴力枚举, 并且不需要将原数列中的数进行 交换, 只需要求出差即可...代码能力呀0.0

#include 
#include
#include
#include
using namespace std;
const int INF=0xffffff;
int num[205],sum[210],s1[210],s2[210];
int work(int *s,int le,int ri)
{
    for(int i=le;is1[f] && t=0 && f


你可能感兴趣的:(CF)