Search found 14 matches

by TripShock
Sat Nov 10, 2007 3:49 pm
Forum: Volume 5 (500-599)
Topic: 567 - Risk
Replies: 46
Views: 16668

WA

Can someone please point out why I'm getting WA for this code? It's just a straightforward implementation of Floyd-Warshall... #include <iostream> #include <algorithm> #include <iomanip> using namespace std; int main() { int Case = 0; while (true) { const int MAX = 20; const int INF = 999999999; int...
by TripShock
Thu Aug 09, 2007 11:16 am
Forum: Volume 111 (11100-11199)
Topic: 11101 - Mall Mania
Replies: 25
Views: 10885

WA

I'm getting WA for my code. Can someone please spot the error... #include <iostream> using namespace std; const int MAX = 10000; int MallA[MAX][2] = { 0 }; int APoints = 0; int MallB[MAX][2] = { 0 }; int BPoints = 0; int GetDist(int X1, int Y1, int X2, int Y2) { int Horizontal = Y1 - Y2; if (Horizon...
by TripShock
Thu Aug 02, 2007 1:57 pm
Forum: Volume 100 (10000-10099)
Topic: 10044 - Erdos Numbers
Replies: 102
Views: 39561

Runtime Error - Invalid Memory Reference

My program gives Runtime Error - Invalid Memory Reference. I understand this could be because my arrays are going out of bounds some place but I can't spot anything. Someone help please... #include <iostream> #include <cstring> #include <cctype> using namespace std; const int MAX = 6000; char Connec...
by TripShock
Sat Feb 17, 2007 8:17 pm
Forum: Volume 101 (10100-10199)
Topic: 10137 - The Trip
Replies: 159
Views: 45366

goin crazy!

could someone please help me with this code... #include <stdio.h> #include <stdlib.h> #define MAX 1000 float round(float a) { char b[128] = { 0 }; sprintf(b, "%.2f", a); a = atof(b); return a; } int main() { int Students = 0; float Spent[MAX] = { 0.0 }; float Total = 0.0; float TotalNew = 0.0; float...
by TripShock
Sun Dec 31, 2006 3:47 pm
Forum: Volume 101 (10100-10199)
Topic: 10137 - The Trip
Replies: 159
Views: 45366

V101 - 10137 - WA

Why is this code WA? It works for all the sample input on this board. #include <stdio.h> #include <stdlib.h> #define MAX 1000 float round(float a) { char b[128] = { 0 }; sprintf(b, "%.2f", a); a = atof(b); return a; } int main() { int Students = 0; float Spent[MAX] = { 0.0 }; float Total = 0.0; floa...
by TripShock
Sun Dec 24, 2006 10:25 pm
Forum: Volume 102 (10200-10299)
Topic: 10222 - Decode the Mad man
Replies: 30
Views: 9101

!!!

strange! the first time i tried it gave compile error! thnx for your time nyways!
by TripShock
Sat Dec 23, 2006 1:12 pm
Forum: Volume 102 (10200-10299)
Topic: 10222 - Decode the Mad man
Replies: 30
Views: 9101

10222

Can anyone find any error in this code? It compiles fine in gcc but the oj flags compile error: parse error b4 character 0222

AC
by TripShock
Sat Dec 23, 2006 1:04 pm
Forum: Volume 5 (500-599)
Topic: 530 - Binomial Showdown
Replies: 137
Views: 33291

WA

can someone please tell me what is wrong with this C code... #include <stdio.h> int main() { int n = 0; int r = 0; unsigned int Result = 1; double Temp = 1.0; int i = 0; while (1) { scanf("%d %d", &n, &r); if (n == 0 && r == 0) break; r = n - r < r ? n - r : r; for (i = r, Temp = 1.0; i >= 1; i--) T...
by TripShock
Sat Jun 24, 2006 6:26 pm
Forum: Volume 4 (400-499)
Topic: 488 - Triangle Wave
Replies: 270
Views: 30518

I don't get it! Now i'm getting WA!!! #include <iostream> using namespace std; int main() { short a = 0; short f = 0; short n = 0; cin >> n; while(n) { cin >> a; cin >> f; for(char i = 1; i <= f; i++) { for(char j = 1; j <= a; j++) { for(char k = 1; k <= j; k++) cout << (int)j; cout << endl; } for(c...
by TripShock
Fri Jun 23, 2006 1:42 am
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24513

I don't know what but something about your sieve code is just SOO right, asif_rahman! thanks a lot! i don't know how but your code got my program accepted!
by TripShock
Thu Jun 22, 2006 9:59 pm
Forum: Volume 4 (400-499)
Topic: 488 - Triangle Wave
Replies: 270
Views: 30518

Input:
1

3
2

Output:
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n


Should I remove the last '\n' ?
by TripShock
Thu Jun 22, 2006 9:55 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24513

That's a really cool method! Thanks! But I still don't get why the oj flags runtime error for my original program!
by TripShock
Thu Jun 22, 2006 11:28 am
Forum: Volume 4 (400-499)
Topic: 488 - Triangle Wave
Replies: 270
Views: 30518

488 - Triangle Wave

this program seems t conform to all the rules but still gets PE! help! #include <iostream> using namespace std; int main() { short a = 0; short f = 0; short n = 0; cin >> n; while(n) { cin >> a; cin >> f; for(char i = 1; i <= f; i++) { for(char j = 1; j <= a; j++) { for(char k = 1; k <= j; k++) cout...
by TripShock
Wed Jun 21, 2006 9:17 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24513

160 - RUNTIME ERROR!!

this code works for all test cases on my pc, but with oj it give runtime error floating point exception! somebody please help!

info:
i use sieve of eratosthenes to compute all prime nos >=2 <= 100.

Code: Select all

ACCEPTED!!

Go to advanced search