• hdu 4422


    #include<stdio.h>
    #include<string.h>
    #define inf  0x7fffffff
    int main() {
        int i,j,k,a[6],n;
        while(scanf("%d",&n)!=EOF) {
            memset(a,0,sizeof(a));

            for(i=0;i<n;i++)
                scanf("%d",&a[i]);
            if(n<=3) {
                printf("1024 ");
                continue;
            }
            if(n==4) {
                int sum=0,max=0;
                for(i=0;i<n;i++)
                    for(j=i+1;j<n;j++) {
                        sum=a[i]+a[j];
                        if(sum==0)
                            sum=0;
                        else
                        if(sum%1024==0)
                            sum=1024;
                        else
                            sum=sum%1024;
                        if(sum>max)
                            max=sum;
                    }
                        for(i=0;i<n;i++)
                            for(j=i+1;j<n;j++)
                                for(k=j+1;k<n;k++)
                                    if((a[i]+a[j]+a[k])%1024==0)
                                        max=1024;
                                    printf("%d ",max);
                                    continue;
                    }
            int mx=0,my=1,mz=2,max=inf;
            for(i=0;i<n;i++)
                for(j=i+1;j<n;j++)
                    for(k=j+1;k<n;k++)
                        if((a[i]+a[j]+a[k])%1024==0&&a[i]+a[j]+a[k]<max) {
                            max=a[i]+a[j]+a[k];
                            mx=i;my=j;mz=k;
                        }
                        if(max==inf) {
                            printf("0 ");
                            continue;
                        }
                         int sum=0;
                        for(i=0;i<5;i++)
                            if(i!=mx&&i!=my&&i!=mz)
                                sum+=a[i];
                            if(sum==0)
                                sum=0;
                            else
                            if(sum%1024==0)
                                sum=1024;
                            else
                            sum=sum%1024;
                            printf("%d ",sum);
        }
        return 0;
    }//一个很好的博客地址解释http://blog.csdn.net/u011519618/article/details/9883465

  • 相关阅读:
    图像修补
    图像的矩
    使用多边形将轮廓包围
    寻找物体的凸包
    查找并绘制轮廓
    重映射
    霍夫变换
    边缘检测
    第二周神经网络基础
    第一周:深度学习引言(Introduction to Deep Learning)
  • 原文地址:https://www.cnblogs.com/thefirstfeeling/p/4410998.html
Copyright © 2020-2023  润新知