Cod sursa(job #1469819)
Utilizator | Data | 9 august 2015 17:38:33 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <stdio.h>
#define LL long long
using namespace std;
string s;
ofstream f;
ifstream g;
int main()
{
f.open("text.out");
g.open("text.in");
getline(g,s);
int cnt=0,w=0;
bool ok=false;
for (int i=0; i<s.size(); i++)
{
if ((s[i]-'0'>16 && s[i]-'0'<43) || (s[i]-'0'>48 && s[i]-'0'<75))
{
cnt++;
ok=true;
}
else if (ok)
{
w++;
ok=false;
}
}
if(ok)
w++;
f<<cnt/w;
return 0;
}