ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1427. SMS

What's wrong with my solution. please help, i don't understand...
Posted by system crash 13 Feb 2011 18:37

int main(int argc, char** argv)
{unsigned long long int min = 0, max = 0;
 unsigned long long int len = 0;
 unsigned long long int tt = 0;
 unsigned long long int counter = 0;
 char a[100001];
 int i;

 scanf("%lld %lld",&min,&max);
 gets(a);
 gets(a);
 len = strlen(a);

for(i = 0;i<len;i++)
{
        if((unsigned char)(a[i])==' ' || isalpha((unsigned char)(a[i])))
        {
        tt++;
        if(tt == max)
        {
            tt = 0;
            counter++;
        }
        }
        else
        {
        tt = 0;
        }

}
if((len-(counter*max))%min == 0)
 counter+=(len-(counter*max))/min;
else
 counter+=(len-(counter*max))/min+1;

 printf("%lld",counter);

    return 0;
}

Edited by author 13.02.2011 18:48