Mai intai trebuie sa te autentifici.
Cod sursa(job #2005844)
Utilizator | Data | 28 iulie 2017 12:47:15 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.66 kb |
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
FILE *fin, *fout;
char c;
int semafor = 0, lungime = 0, sum = 0, nrc = 0;
fin = fopen("text.in", "r");
fout = fopen("text.out", "w");
c = fgetc( fin );
while(c != '\n')
{
if('A' <= c && c <= 'z' && semafor == 0)
{
semafor = 1;
lungime++;
nrc++;
}
else if('A' <= c && c <= 'z')lungime++;
else if(semafor == 1)
{
semafor = 0;
sum += lungime;
lungime = 0;
}
c = fgetc( fin );
}
fprintf(fout, "%d", sum / nrc);
fclose( fin );
fclose( fout );
return 0;
}