Mai intai trebuie sa te autentifici.
Cod sursa(job #972741)
| Utilizator | Data | 12 iulie 2013 16:22:27 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.7 kb |
#include<cstdio>
#define CLOSE fclose(in); fclose(out); return 0;
using namespace std;
int verif(char c){
if(c>='A' && c<='Z')
return 1;
if(c>='a' && c<='z')
return 1;
return 0;
}
int main(){
FILE *in=fopen("text.in","r");
FILE *out=fopen("text.out","w");
char c=fgetc(in);
int st=0,nrc=0,nrl=0;
while(c!=EOF){
if(st==0 && verif(c)){
nrl++;
nrc++;
st=1;
} else if(st==1 && verif(c))
nrl++;
else if(st==1 && !verif(c))
st=0;
c=fgetc(in);
}
if(nrc)
fprintf(out,"%d",nrl/nrc);
else
fprintf(out,"0");
CLOSE
}
