Cod sursa(job #1233936)

Utilizator AlexandraMafteiAlexandra Maftei AlexandraMaftei Data 26 septembrie 2014 13:18:55
Problema Numarare triunghiuri Scor 0
Compilator c Status done
Runda Arhiva de probleme Marime 0.76 kb
# include <stdio.h>

int v[100];
int main () {
    FILE *fin, *fout;
    int n, a, b, c, aux;

    fin = fopen ( "nrtri.in", "r" );
    fscanf ( fin, " %d %d %d ", &a, &b, &c );

    aux = 1;
    c = 0;
    for ( i = 1; i <= n ; i ++ ) {
        while ( a + b >= c ) {
            v[a] = v[b];
            v[b] = v[c];
            aux = v[a];
            c++;
        }

        while ( b + c >= a ) {
            v[b] = v[c];
            v[c] = v[a];
            aux = v[b];
            c++;
        }

        while ( c + a >= b ) {
            v[c] = v[a];
            v[a] = v[b];
            aux = v[c];
            c++,
        }
    }

    fclose (fin);
    fout = fopen ( "nrtri.out", "w" );
    fscanf ( fopen, " %d %d %d ", c );
    fclose ( fout );

    return 0;
    }