TOPIC

PROBLEM 1189 - URI Fórum 1.0

beecrowd asked on Feb 8 2013

URI Online Judge Fórum 1.0

MOD

This topic was solved and cannot recieve new replies.

  • ggroth replied 7 years ago

    Os valores em 1 são os que tu está usando no cálculo:

    000000000000
    100000000000
    110000000000
    111000000000
    111100000000
    111110000000
    111110000000
    111110000000
    111110000000
    111110000000
    111110000000
    000000000000
  • jfmagnabosco replied 7 years ago

    o que tem de errado

    include

    include

    include

    using namespace std;

    int main() { //freopen("testando.in.c","r",stdin);

    int i,j;
    double M[12][12],S=0,x=0,med=0,aux;
    char O;
    
    cin >> O;
    
    for(i=0; i<12; i++) {
        for(j=0; j<12; j++) {
            cin >> M[i][j];
        }
    }
    
    aux=0;
    for(j=0;j<5;j++){
        for(i=j+1;i<11;i++){
            S += M[i][j];
            aux = aux + 1;
        }
    
    }
    
    cout << fixed << setprecision(1);
    
    if(O=='S') {
        cout << S <<endl;
    } else {
        med = S /aux;
        cout << med << endl;
    }
    
    return 0;

    }

  • erodrigues replied 9 years ago

    A lógica está correta, apenas tem uma variável sendo usada em um lugar errado.

    MOD
  • ssoares0 replied 9 years ago

    Por que dá WA?????

    #include <stdio.h>
    
    #define MAX 12 
    int main(){
    
    int i,j,n=0,cont=0;
    double M[MAX][MAX],soma1=0,soma2=0,soma3=0;
    char t;
        scanf("%c", &t);
        for(i=0;i<MAX;i++){
            for(j=0;j<MAX;j++){
                scanf("%lf", &M[i][j]);
            }
        }
        for(j=0;j<5;j++){
            for(i=j+1;i<6;i++){
            soma1 += M[i][j];
            }
            for(i=10-j;i>5;i--){
            soma2 += M[i][j];
            }   
            soma3=soma1+soma2;
        }       
    
        if(t=='S'){printf("%.1lf\n",soma2);}
        else{ printf("%.1lf\n",soma2/30);}
    }