Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Deathmask Tabela C++ 100/100OK 13. okt '18 @ 11:14

Test Točke Porabljen spomin Porabljen čas Status
#1 20/20 4,121 MiB 0,102 s OK
#2 20/20 3,191 MiB 0,000 s OK
#3 20/20 3,195 MiB 0,000 s OK
#4 20/20 3,180 MiB 0,004 s OK
#5 20/20 3,184 MiB 0,010 s OK

Ocenjevani program (main.cpp):
#include <iostream>

using namespace std;
void prs(int n){
    for (int i=0;i<n;i++){

        cout<<" ";


    }


}
int main()
{
    int r,c;
    cin>>r>>c;
    string mat[r][c];
    string aln;
    cin>>aln;
    for (int i=0;i<r;i++){
        string in;
        cin>>in;
        int j=0;
        for (int i1=0;i1<c;i1++){
        string tmp="";
        while (in[j]!=',' && j<in.length()){
            tmp+=in[j];
            j++;
        }
            mat[i][i1]=tmp;
            j++;
        }
    }
    int maxs[c];
    for (int i=0;i<c;i++){
        int tmp=0;
        for (int j=0;j<r;j++){
            if (mat[j][i].length()>tmp){
                tmp=mat[j][i].length();
            }
            maxs[i]=tmp;


    }
    }

    string splt=" | ";

    for (int i=0;i<r;i++){

        for (int j=0;j<c;j++){

            if (aln[j]=='R'){
                prs((maxs[j]-mat[i][j].length()));
            }

            cout<<mat[i][j];

            if (aln[j]=='L'){
                prs((maxs[j]-mat[i][j].length()));
            }
            if (j!=c-1)
            cout<<splt;
        }
        cout<<endl;

    }
    return 0;
}