Finally, I solved it!
Numbers of vitamin are maximum 15, therefore it can be solved by
2^15 complete search.
I used "looping through find all the subsets of a set", and it works very fast. Thx!
Search found 106 matches
- Wed Feb 28, 2007 4:24 am
- Forum: Algorithms
- Topic: USACO 2.1 Healthy Holstein
- Replies: 2
- Views: 3722
- Mon Feb 26, 2007 6:37 pm
- Forum: Algorithms
- Topic: USACO 2.1 Healthy Holstein
- Replies: 2
- Views: 3722
USACO 2.1 Healthy Holstein
I try to solve this problem using backtracking. However, test case 8 caused TLE ( 2sec. ) . Is there other solution? Or I must improve my backtracking algorithm? If you already solved it, plz help me. [Problem Statement] Farmer John prides himself on having the healthiest dairy cows in the world. He...
- Wed Feb 14, 2007 9:52 am
- Forum: Volume 100 (10000-10099)
- Topic: 10079 - Pizza Cutting
- Replies: 44
- Views: 15812
10079 Pizza Cutting - I want to know the proof.
It's a very easy problem, and I solved it within 10 min.
In my intuition, I can see that answer makes following arithmetic progression
a(n) = 1 + (n(n+1))/2;
However, I want to know why pizza cutting makes this expression.
Anyone tell me the proof of this expression?
In my intuition, I can see that answer makes following arithmetic progression
a(n) = 1 + (n(n+1))/2;
However, I want to know why pizza cutting makes this expression.
Anyone tell me the proof of this expression?
- Wed Feb 14, 2007 4:19 am
- Forum: Volume 4 (400-499)
- Topic: 483 - Word Scramble
- Replies: 122
- Views: 36536
Your progam prints wrong blanks...
You must remove only last blanks, and other blanks must same as input string.
For example,
Input ( _ means blank )
Presentation Error
Accepted
Good luck.
You must remove only last blanks, and other blanks must same as input string.
For example,
Input ( _ means blank )
Code: Select all
__I___love_you.___
Code: Select all
__I___evol_.uoy___
Code: Select all
__I___evol_.uoy
- Wed Feb 14, 2007 4:12 am
- Forum: Volume 4 (400-499)
- Topic: 483 - Word Scramble
- Replies: 122
- Views: 36536
You must remove only last blanks, and other blanks must same as input string.
For example,
Input ( _ means blank )
Presentation Error
Accepted
Good luck.
For example,
Input ( _ means blank )
Code: Select all
__I___love_you.___
Code: Select all
__I___evol_.uoy___
Code: Select all
__I___evol_.uoy
- Tue Feb 13, 2007 7:51 am
- Forum: Volume 5 (500-599)
- Topic: 539 - The Settlers of Catan
- Replies: 22
- Views: 10447
- Wed Jan 31, 2007 4:05 pm
- Forum: Volume 5 (500-599)
- Topic: 524 - Prime Ring Problem
- Replies: 74
- Views: 29107
- Fri Jan 26, 2007 10:11 am
- Forum: C++
- Topic: 2D string array for STL sort
- Replies: 3
- Views: 3244
2D string array for STL sort
I'm so awkward using in STL. When I implemented 2D array sort in C, I used bubble sort. But I want to know how can I sort 2D array in STL sort(). For example, // before sort string data[3][2] = { {"cab","hello"}, {"cba","world"}, {"abc","haha&qu...
- Fri Jan 26, 2007 3:50 am
- Forum: Volume 103 (10300-10399)
- Topic: 10315 - Poker Hands
- Replies: 63
- Views: 37058
My solution still received WA.. Thx, Jan. My program passed all of your test case, but it cannot pass the OJ's test. I found one critical input, so I modified my code. But I recieved WA.. My critical Input 4C 4C 8C 7C 5C 3D 3D 8D 7D 6D In this test case, both hands are flush. According to the proble...
- Thu Jan 25, 2007 12:14 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10315 - Poker Hands
- Replies: 63
- Views: 37058
It's really tricky... I can't solve this problem though all of Jan's test case passed... If anyone have critical test case for this problem, plz tell me about it. And I have another question. Full House: 3 cards of the same value, with the remaining 2 cards forming a pair. Ranked by the value of the...
- Sat Dec 30, 2006 10:14 pm
- Forum: Volume 111 (11100-11199)
- Topic: 11151 - Longest Palindrome
- Replies: 65
- Views: 41377
11151 - Longest Palindrome
hmm.. It's so tricky. It just looks like an easy problem, but I received WA repeatedly... Is there any critical input?
- Thu Dec 21, 2006 10:07 am
- Forum: Off topic (General chit-chat)
- Topic: Super Fast Programmer
- Replies: 18
- Views: 36740
- Thu Dec 21, 2006 6:30 am
- Forum: Other words
- Topic: North Korean Team advance to World Final in Japan?
- Replies: 0
- Views: 2068
North Korean Team advance to World Final in Japan?
I'm so curious about this year's World Final teams. Especially, I noticed that some of north korean teams joined in this year's regional contest in Xian site, Asia (China). http://icpc.baylor.edu/icpc/regionals/ViewRegionalStandings.asp?ContestID=790 Two schools are represented for North Korea. KimC...
- Wed Dec 06, 2006 2:56 am
- Forum: Volume 9 (900-999)
- Topic: 900 - Brick Wall Patterns
- Replies: 16
- Views: 11649
- Wed Dec 06, 2006 2:11 am
- Forum: Volume 9 (900-999)
- Topic: 900 - Brick Wall Patterns
- Replies: 16
- Views: 11649
900 - Brick Wall Patterns
It's a very easy problem. However, I received TLE from judge.
I don't know why my solution received TLE. It works well my VC++ and
g++ compiler.
Anyone tell me why my solution received TLE. Thx.
I don't know why my solution received TLE. It works well my VC++ and
g++ compiler.
Anyone tell me why my solution received TLE. Thx.
Code: Select all
Remove my accepted code