Cod sursa(job #2806226)
| Utilizator | Data | 22 noiembrie 2021 14:23:08 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.63 kb |
#include <stdio.h>
using namespace std;
FILE* f, * g;
int main()
{
char ch;
int ok = 0;
long long nr = 0, cuv = 0, sol;
f = fopen("text.in", "r");
g = fopen("text.out", "w");
ch = fgetc(f);
while (!feof(f))
{
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
nr++, ok = 1;
else
{
if (ok == 1)
cuv++;
ok = 0;
}
ch = fgetc(f);
}
if (cuv != 0)
sol = nr / cuv;
else
sol = 0;
fprintf(g, "%lld", sol);
fclose(f);
fclose(g);
return 0;
}