Search found 16 matches

by peterkwan
Sun Oct 25, 2009 4:00 pm
Forum: Volume 9 (900-999)
Topic: 943 - Number Format Translator
Replies: 4
Views: 2893

943 - Number Format Translator

Here is my code. I got WA but I don't know what I have done wrongly. Please give some inputs that my code fails. Thanks. #include <iostream> #include <map> #include <algorithm> #include <sstream> using namespace std; map<string, long long> m; string& replace_all(string& str,const string& old_val, co...
by peterkwan
Fri Oct 16, 2009 5:01 am
Forum: Volume 116 (11600-11699)
Topic: 11659 - Informants
Replies: 31
Views: 8625

Re: 11659 - Informants

Please read carefully what I said :wink: : If 1 is reliable , then a)7 is not reliable, (since 7 says 1 is not reliable) but you said: i think there's a little prob with ur thinking.......in ur thinking...... if 1 is not reliable then 7 is obviously not reliable.......but i think thats not right ;) ...
by peterkwan
Wed Oct 14, 2009 6:20 am
Forum: Volume 116 (11600-11699)
Topic: 11659 - Informants
Replies: 31
Views: 8625

Re: 11659 - Informants

On that case, 2 can be also reliable.. :-) Yes, 2 can be reliable. Please tell me whether my following logic to solve the problem is incorrect: for each input of X and Y, ( BX = The current state of X BY = The current state of Y If BX is not set and BY is not set => set BX = 1 or 0 If BX is set but...
by peterkwan
Tue Oct 13, 2009 7:43 am
Forum: Volume 116 (11600-11699)
Topic: 11659 - Informants
Replies: 31
Views: 8625

Re: 11659 - Informants

try this input 20 6 1 -3 2 -3 3 1 2 2 7 -1 4 3 the rigth out put should be 18......your code shows 19..... :wink: I don't quite understand why this input causes 18. From my understanding, If 1 is reliable, then a) 7 is not reliable, (since 7 says 1 is not reliable) and b) 3 is not reliable. (since ...
by peterkwan
Sun Oct 11, 2009 8:06 am
Forum: Volume 116 (11600-11699)
Topic: 11659 - Informants
Replies: 31
Views: 8625

Re: 11659 - Informants

My code passed the test cases as listed in this thread, but I still get WA. What is wrong with my code? Thanks. #include <iostream> using namespace std; main() { int i, a, x, y; while (cin >> i >> a) { if (i==0 && a==0) break; bool b[i]; for (int j=0; j<i; j++) b[j]=true; for (int j=0; j<a; j++) { c...
by peterkwan
Wed Oct 07, 2009 11:52 am
Forum: Volume 116 (11600-11699)
Topic: 11659 - Informants
Replies: 31
Views: 8625

Re: 11659 - Informants

How about the following case:

Code: Select all

5 5
1 -2
2 -1
4 -1
3 -4
5 -3
by peterkwan
Tue Sep 29, 2009 8:15 am
Forum: Volume 116 (11600-11699)
Topic: 11679 - Sub-prime
Replies: 1
Views: 1477

11679 - Sub-prime

I got WA all the time for this problem. I guess I have overlooked something unsure, since my program passed the test cases given in the problem description. Could someone post some critical inputs? Thanks.
by peterkwan
Sun Jan 25, 2009 2:30 pm
Forum: Volume 114 (11400-11499)
Topic: 11489 - Integer Game
Replies: 9
Views: 3880

Re: 11489 - Integer Game

Some one can explain these case??? INPUT: 2 44455 44555 OUTPUT: S S Why??? I am confused. :-? This is because: A player can remove a particular digit if the sum of digits of the resulting number is a multiple of 3 or there are no digits left. Since S moves first, the obvious way is to remove the re...
by peterkwan
Thu Jan 01, 2009 11:56 am
Forum: Volume 115 (11500-11599)
Topic: 11571 - Simple Equations - Extreme!!
Replies: 31
Views: 11105

Re: 11571 - Simple Equations - Extreme!!

I have tried to tackle this problem but I am getting WA. I have passed the given input in this thread. here is my code: #include <iostream> #include <cmath> using namespace std; main() { int n; long double a, b, c, x, y, z; long double p, q, d, u, v, phi, e, e1; double pi = acos(-1.0); cin >> n; for...
by peterkwan
Sun Sep 21, 2008 5:32 am
Forum: Volume 114 (11400-11499)
Topic: 11489 - Integer Game
Replies: 9
Views: 3880

Re: 11489 - Integer Game how to solve?

LayCurse, thanks for your input. I modified my code and finally passed the test case above. However, I am still getting WA. Could somebody helps what test case my code below will fail? Thanks a lot. #include <iostream> using namespace std; main() { int n; cin >> n; for (int i=0; i<n; i++) { string s...
by peterkwan
Sat Sep 20, 2008 12:58 pm
Forum: Volume 114 (11400-11499)
Topic: 11489 - Integer Game
Replies: 9
Views: 3880

Re: 11489 - Integer Game how to solve?

I am getting WA all the time. Please help to give some critical inputs. Thanks. #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i=0; i<n; i++) { string s; cin >> s; int n2 = s.size(); cout << "Case " << (i+1) << ": "; // cout << s << " - "; if (n2==1) cout << "S" << e...
by peterkwan
Sun Feb 24, 2008 4:30 pm
Forum: Volume 100 (10000-10099)
Topic: 10058 - Jimmi's Riddles
Replies: 22
Views: 6387

I tested my program and all the test cases in the sample and in this thread are passed. However, I still get WA all the time? could somebody help? #include <iostream> #include <string> using namespace std; string trim(string s) { s.erase(0,s.find_first_not_of(" ")); s.erase(s.find_last_not_of(" ")+1...
by peterkwan
Sun Dec 16, 2007 8:17 am
Forum: Volume 4 (400-499)
Topic: 485 - Pascal's Triangle of Death
Replies: 50
Views: 4863

Here is my code and got WA: #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; string calc_sum(string str1, string str2) { string s1 = str1, s2 = str2; if (str1.length() > str2.length()) { for (int i = str2.length(); i < str1.length(); i++) s2 = '0' + s...
by peterkwan
Sun Nov 04, 2007 4:42 pm
Forum: Volume 4 (400-499)
Topic: 471 - Magic Numbers
Replies: 29
Views: 11027

i have tried the problem and got WA for several times, even I used the algorithm posted by Sedefcho. Here is my code: #include <iostream> #include <string> #include <sstream> using namespace std; #define S1_MAX 9876543210ULL bool checkDigits(unsigned long long s1) { string n_str = ""; ostringstream ...
by peterkwan
Sun Nov 04, 2007 8:42 am
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 30570

Found my problem already. Thanks.

Go to advanced search