Search found 20 matches

by athlon19831
Fri Feb 24, 2006 2:12 pm
Forum: Volume 4 (400-499)
Topic: 445 - Marvelous Mazes
Replies: 93
Views: 10420

445 WA

Why i got WA? #include <iostream> using namespace std; #include <cstring> #include <cstdio> #define N 10000 typedef struct { char c; long num; }Z; int main(int argc, char* argv[]) { char str[N]; long i,j,k,l,sum; Z z; z.num=0; while(gets(str)) { l=strlen(str);sum=0; for(i=0;i<l;i++) { if(str >='0'&&...
by athlon19831
Sun Feb 19, 2006 5:14 pm
Forum: Volume 4 (400-499)
Topic: 483 - Word Scramble
Replies: 122
Views: 19958

483 Presentation Error

i don't know why i got Presentation Error it's my code #include <iostream> using namespace std; #include <cstring> #include <cstdio> int main(int argc, char* argv[]) { char str[1000]; char copy[1000]; char s[1000][1000]; long i,j,l,m,k; bool flag,flag2; while(gets(str)) { l=strlen(str); j=0; copy[l]...
by athlon19831
Thu Feb 09, 2006 8:39 am
Forum: Volume 3 (300-399)
Topic: 382 - Perfection
Replies: 95
Views: 19168

382 WA pls give me some test cases

382 WA pls give me some test cases
by athlon19831
Wed Feb 08, 2006 2:08 pm
Forum: Volume 3 (300-399)
Topic: 382 - Perfection
Replies: 95
Views: 19168

382 WA

i don't know why i got WA instead of AC. my code following: #include <iostream> using namespace std; #include <cstring> #include <cstdio> #include <cmath> int main(int argc, char* argv[]) { char str[1000]; long copy[110]; long s[110]; long i,j,k,l,sum,val,i_save,j_copy; //bool flag; for(i=0;i<100;i+...
by athlon19831
Sun Feb 05, 2006 4:42 pm
Forum: Volume 102 (10200-10299)
Topic: 10295 - Hay Points
Replies: 20
Views: 9158

10295 WA (need some Sample Input!!!)

10295 WA ( I need some Sample Input!!!)
by athlon19831
Sat Feb 04, 2006 4:08 pm
Forum: C++
Topic: about next_permutation() my VC6.0 can't run this function
Replies: 2
Views: 1681

about next_permutation() my VC6.0 can't run this function

about next_permutation() my VC6.0 can't run this function
why?
by athlon19831
Wed Feb 01, 2006 4:01 pm
Forum: Volume 101 (10100-10199)
Topic: 10179 - Irreducible Basic Fractions
Replies: 28
Views: 9753

10179 Time Limit Exceeded

#include "iostream.h" #include "stdio.h" #include "string.h" #include "math.h" bool Gcd(long M,long N) { long Rem; while(N>0) { Rem=M%N; M=N; N=Rem; } if(M==1) return true; else return false; } int main(int argc, char* argv[]) { long n; long i,j; long num; while(cin>>n) { if(n==0) break; else { num=...
by athlon19831
Tue Jan 31, 2006 5:07 pm
Forum: Volume 4 (400-499)
Topic: 446 - Kibbles "n" Bits "n" Bits "n" Bits
Replies: 50
Views: 4625

446 Output Limit Exceeded

my code :( #include "iostream.h" #include "stdio.h" #include "string.h" int main(int argc, char* argv[]) { long N; char h1[3],h2[3]; char b1[15],b2[15]; long val; long l1,r1; long i,j; long sum1,sum2; long sum; char c; while(cin>>N) { for(i=0;i<N;i++) { cin>>h1>>c>>h2; l1=strlen(h1); r1=strlen(h2); ...
by athlon19831
Mon Jan 30, 2006 4:39 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61290

10200 Time Limit Exceeded (need help)

I don't know why i always got Time Limit Exceeded. My code: #include "iostream.h" #include "stdio.h" #include "math.h" #include "string.h" int main(int argc, char* argv[]) { long a,b,i,j,k,num,l; double t; double sum; while(cin>>a>>b) { num=0; l=b-a+1; for(i=a;i<=b;i++) { j=i*i+i+41; t=sqrt(j); for(...
by athlon19831
Sun Jan 29, 2006 11:15 am
Forum: Volume 105 (10500-10599)
Topic: 10551 - Basic Remains
Replies: 11
Views: 5949

10551 Runtime Error

why? anyone could help me my code: #include "iostream.h" #include "stdio.h" #include "math.h" #include "string.h" int main(int argc, char* argv[]) { char str[2000]; char m[100]; long b; long i,j,l1,l2; long sum_p,sum_m; long val; long sum; while(cin>>b) { sum_p=0; sum_m=0; if(b==0) break; else if(b=...
by athlon19831
Sat Jan 28, 2006 1:11 pm
Forum: Volume 109 (10900-10999)
Topic: 10929 - You can say 11
Replies: 69
Views: 26751

You are calling strlen each time in the for loop you print the input number. And in fact, you can print out a char array directly just like C++ strings. Just do a cout << str for the places where you print the input number character by character and the TLE should go away. If not, you might wan to ...
by athlon19831
Sat Jan 28, 2006 8:31 am
Forum: Volume 109 (10900-10999)
Topic: 10929 - You can say 11
Replies: 69
Views: 26751

10929 - You can say 11

I got Time Limit Exceeded,but i don't know why my code: #include "iostream.h" #include "stdio.h" #include "string.h" #include "math.h" int main(int argc, char* argv[]) { char str[1010]; int s_odd,s_even; int s; int i,j; while(cin>>str) { if(strcmp(str,"0")==0) break; else if(str[0]=='-') break; else...
by athlon19831
Thu Jan 26, 2006 8:14 am
Forum: Volume 4 (400-499)
Topic: 490 - Rotating Sentences
Replies: 212
Views: 20195

490 Presentation Error

#include<iostream.h> #include"string.h" #include"stdio.h" void main(int argc, char* argv[]) { char a[100],b[100][150]; int k=0; int i,j,m,n; while(gets(a)) { strcpy(b[k],a); k++; } for(j=0;;j++) { m=0; for(i=k-1;i>=0;i--) { n=strlen(b ); if(j>=n) continue; else { cout<<b [j]; m=1; } } cout<<endl; if...
by athlon19831
Wed Jan 25, 2006 5:31 pm
Forum: Volume 5 (500-599)
Topic: 568 - Just the Facts
Replies: 39
Views: 16564

568 how to reduce the run time? anyone can help me ?

i found the run time is too long. this is my code: #include "iostream.h" #include "stdio.h" int main(int argc, char* argv[]) { long n; long sum; long i; while(cin>>n) { sum=1; for(i=n;i>0;i--) { sum*=i; } while(sum>0) { if(sum%10!=0) { cout<<sum%10<<endl; sum/=10; break; } else sum/=10; } } return 0...
by athlon19831
Wed Jan 25, 2006 11:24 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 57357

10035 WA

my code:i want to know why i got WA #include "iostream.h" #include "math.h" #include "string.h" int main(int argc, char* argv[]) { char str1[11],str2[11]; long num1[11],num2[11]; long i,j; long m,k; long m1,k1; long n; while(cin>>str1>>str2) { if(strcmp(str1,"0")==0&&strcmp(str2,"0")==0) break; else...

Go to advanced search