## Search found 33 matches

Wed Aug 14, 2002 8:34 am
Forum: Volume 2 (200-299)
Topic: 271 - Simply Syntax
Replies: 46
Views: 12473
thanx, i will go find it and get it fixed~
Wed Aug 14, 2002 5:28 am
Forum: Volume 5 (500-599)
Topic: 554 - Caesar Cypher
Replies: 27
Views: 10545
and here's my code... why wa? [cpp] #include <iostream> #include <string.h> char dict[100][30],str[300],d[27]; int n,map[128]; void init () { char ch; for (ch='A';ch<='Z';ch++) map[ch] = ch-'A'+1; map[' '] = 0; for (ch='A';ch<='Z';ch++) d[ch-'A'+1] = ch; d[0] = ' '; } int search (char s[]) { for (in...
Wed Aug 14, 2002 2:58 am
Forum: Volume 2 (200-299)
Topic: 271 - Simply Syntax
Replies: 46
Views: 12473
with a glance at this problem, i thought it just another easy one which would be solved by simple recursion. but i was wrong. i got TLE first, then i modified my code a little and got AC. what about the string NNNNNNN...NNNNNNNNCst 253 N 1 C 1 s 1 t totally 256 chars how long does your program run w...
Tue Aug 13, 2002 3:32 am
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 31040

### 793

i use disjoint tree(Union() and Find()) to solve this problem but unfortunately i kept getting TLE :cry: any one could be any of help? here's the code [cpp] #include <iostream> #include <string.h> #include <stdlib.h> #define myin cin using namespace std; int parent[1000],root[1000]; inline int Find ...
Sun Aug 11, 2002 9:12 am
Forum: Volume 101 (10100-10199)
Topic: 10127 - Ones
Replies: 32
Views: 12504
do not think 2 much about the number of digits that requires storage.

just check the remainder and that will be ok.

this problem has just something to do with the remaider.
Sun Aug 11, 2002 6:57 am
Forum: Volume 5 (500-599)
Topic: 551 - Nesting a Bunch of Brackets
Replies: 56
Views: 12162
i've modified the code and then got AC but there're still some questions... i think the cases above should require "NO" instead of "YES" 'coz the charactors are not actually bracketed in pairs of brackets... and what about such cases below? ()a a() ()* ()*() <--- it seems that "*" is bracketed, but ...
Sun Aug 11, 2002 6:44 am
Forum: Volume 5 (500-599)
Topic: 551 - Nesting a Bunch of Brackets
Replies: 56
Views: 12162
and what about such cases below?

()a
a()
()*
()*()

my program gives
NO 3
NO 1
NO 3
NO 3

...
Sun Aug 11, 2002 6:09 am
Forum: Volume 5 (500-599)
Topic: 551 - Nesting a Bunch of Brackets
Replies: 56
Views: 12162

### 551 help

I've thought about possible test cases but still got WA:( here's my code any one help pls~ [cpp] #include <iostream> #include <stack> #include <string.h> using namespace std; char str[10000]; int solve () { int count,idx,len; stack<int> st; count = 0; idx = 0; len = strlen(str); st.push(0); while (i...
Sat Aug 10, 2002 3:22 pm
Forum: Volume 2 (200-299)
Topic: 271 - Simply Syntax
Replies: 46
Views: 12473

### Got AC but poor speed with problem 271

I actually use DP to solve this problem but the speed is not so satisfactory It ran 26 secs... i hope that somebody could help me with the poor speed :oops: here is the code [cpp] #include <iostream> #include <string.h> using namespace std; int valid[128],ok[300][300]; char str[300]; void init () { ...
Sat Aug 10, 2002 3:19 pm
Forum: Volume 2 (200-299)
Topic: 270 - Lining Up
Replies: 48
Views: 16193
SIGSEGV means

SIGnal of SEGment Violation

it often occurs when referring to invalid memory
eg. the subscript of the array exceeds the range what it should be within.

check your code carefully and think more over about where it is likely to happen.

good luck
Fri Aug 09, 2002 2:42 pm
Forum: Volume 7 (700-799)
Topic: 758 - The Same Game
Replies: 7
Views: 3774

### 758 - The Same Game

I kept gettin' WA with problem 758.
Can any one gimme some special test case???
Mon Aug 05, 2002 3:30 pm
Forum: Volume 5 (500-599)
Topic: 539 - The Settlers of Catan
Replies: 22
Views: 8074

### Solution

I've modified your code a little and merged with my code, then got AC... The problem with your code lies in the varible "not_visited". There's no need to use this varible to mark the node visited. The problems just has something to do with the EDGE not the NODE. So to mark the node is not reasonable...
Sun Aug 04, 2002 4:04 am
Forum: Volume 4 (400-499)
Topic: 474 - Heads / Tails Probability
Replies: 50
Views: 10889
I've changed my algorithm and got AC.
Perhaps I've been thinkin' too much.
Any way, thank you all the same
Sat Aug 03, 2002 5:48 pm
Forum: Volume 4 (400-499)
Topic: 474 - Heads / Tails Probability
Replies: 50
Views: 10889

### p474 keepin' WA

i don't think that my code is wrong, and i check the output with the calculator. i am now confused... any one help me pls![cpp] #include <iostream> #include <iomanip> #include <math.h> using namespace std; double val[1001][2]; void pre () { double a; long b; for (int i=1;i<=1000;i++) { a = pow(2,i);...
Sat Aug 03, 2002 3:12 pm
Forum: Volume 4 (400-499)
Topic: 485 - Pascal's Triangle of Death
Replies: 50
Views: 4878

### p485 help!!!

keep getting WA. anything wrong with my code? help pls. [cpp] #include <iostream> #include <memory.h> using namespace std; typedef struct { unsigned long a[8]; } big_t; big_t s[210],t[210]; const int MAX = 204; inline void plus (const big_t &a,const big_t &b,big_t &c) { int i; for (i=0;i<8;i++) c.a ...