Cod sursa(job #52728)

Utilizator MirceampMuresan Mircea Paul Mirceamp Data 19 aprilie 2007 19:39:01
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.17 kb
#include<fstream>
#include<string.h>

using namespace std;

char c[100000];
int p,q,gata;
int main()
{
    ifstream fin("text.in");
    ofstream fout("text.out");
    int i,j;
    fin.getline(c,100000);
          while(gata <= strlen(c))
          {
                     if (c[gata] - '0' >= 49 && c[gata]- '0' <= 74 || c[gata]- '0' >= 17 && c[gata]- '0' <= 42)
                    {
                        for(i = gata; i <= strlen(c); i++)
                    if(c[i] - '0' >= 49 && c[i]- '0' <= 74 || c[i]- '0' >= 17 && c[i]- '0' <= 42)
                    p++;
                    else
                    {
                        for(j = i+1; j <= strlen(c); j++)
                        if(c[j] - '0' >= 49 && c[j]- '0' <= 74 || c[j]- '0' >= 17 && c[j]- '0' <= 42)
                         {
                         q++;
                         break;
                         }
                         else
                         continue;
                    }       
                    gata = i;
                    }
                    else
                    gata++;
    }
        fout<<p/q; 
fin.close();
fout.close();

return 0;

}