|
|
back to boardDiscussion of Problem 1427. SMSWhat's wrong with my solution. please help, i don't understand... 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 |
|
|