这就是强行枚举的魅力所在

N^2次循环,最多40000.

2 条评论

  • @ 2016-10-08 22:02:20

    何人能看懂?

  • @ 2016-10-08 22:02:03
    #include <stdio.h>
    
    int gg[101];
    int g[101];
    int s;  
    int a[201][3];
    int main()
    {
        
        
        int c, d;
        
        scanf("%d", &c);
        
        for ( int e = 0; e < c; e ++){
            
            for ( int f = 0; f < 3; f++)
                scanf("%d", &a[e][f]);
        }
        
    
        for ( int f = 0; f < 3; f ++){
            
            for (int e = 0; e < c; e ++){
                
                g[a[e][f]] ++;
                if (g[a[e][f]] == 1)
                    gg[a[e][f]] = e;
                
                if ( g[a[e][f]] > 1){
                    
                    a[gg[a[e][f]]][f] = 0;
                    a[e][f] = 0;
                }
            }
            
            for ( int h = 0; h < 101; h ++)
                gg[h] = 0;
            for ( int h = 0; h < 101; h ++)
                g[h] = 0;
        }
        
        
        printf("\n");
        int y[c];
        for ( int e = 0; e < c; e ++)
            y[e] = 0;
        for ( int e = 0; e < c; e ++){
            
            for (int f = 0; f < 3; f ++){
                
                printf("%d ", a[e][f]);
                
            }
            
            printf("\n");
            //goto kl;
        }
        
        
    kl:
        for ( int e = 0; e < c; e ++){
            
            for ( int f = 0; f < 3; f ++){
                
                    y[e] += a[e][f]; 
            }
        } 
        
        for ( int e = 0; e < c; e ++)
            printf("%d\n", y[e]);
    }
    
  • 1

信息

ID
1941
难度
3
分类
(无)
标签
递交数
897
已通过
473
通过率
53%
被复制
2
上传者