Cod sursa(job #52760)

Utilizator vladbBogolin Vlad vladb Data 19 aprilie 2007 21:12:51
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.23 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);
    /*for(i = gata; i < strlen(c); i++)
    fout<<c[i];*/
       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;

}