Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

TLE in June cook off 2013 Attic Problem-C++

$
0
0

Why does TLE show up?? Following code is in C++ 4.3.2

include<cstdio>

include<cstdlib>

include<cmath>

include<string.h>

define TMAX 1000007

define PMAX 1000007

int main() { long long T; long long i; long long length; long long memory; long long count=0; long long answer=0; scanf("%lld",&T);

while(T--) { char P[PMAX]=""; answer=0; scanf("%s",P); length=strlen(P); memory=0; for(i=0;i<length;) { count=0;

if(P[i]=='.') { while(P[i++]=='.') count++;

if(count>memory)
{
 answer++;
 memory=count;
}

} else i++;

} printf("%lld\n",answer); }

return EXIT_SUCCESS; }


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>