Search found 26 matches

by hahahaken
Mon Jun 09, 2008 1:53 pm
Forum: Volume 101 (10100-10199)
Topic: 10101 - Bangla Numbers
Replies: 122
Views: 31770

Re: 10101 - Bangla Numbers

DJWS wrote:You can solve this problem with the Divide and Conquer approach.
How? Can you explain a little bit?
by hahahaken
Sun Jun 08, 2008 2:17 pm
Forum: Volume 101 (10100-10199)
Topic: 10101 - Bangla Numbers
Replies: 122
Views: 31770

Re: 10101 - Bangla Numbers

Here's how I solve the problem not using hard code 1. Use "/" and "%" to extract one or two integer(s) from the input and use an integer array of size 9 to store them As the max number is 999999999999999, which is 15 digits, the max size the input number can be divided is 9, acco...
by hahahaken
Fri May 30, 2008 6:06 pm
Forum: Volume 106 (10600-10699)
Topic: 10673 - Play with Floor and Ceil
Replies: 11
Views: 7025

Re: 10673 - Play with Floor and Ceil

Solved, I think the most difficult part is to find the relationship between k,p and q using the modular
by hahahaken
Fri May 30, 2008 10:43 am
Forum: Volume 4 (400-499)
Topic: 488 - Triangle Wave
Replies: 270
Views: 38642

Re: 488 TLE

Finally got AC, thanks But I want to know why the following can make my program run faster: 1. What's the difference between "endl" and "\n"? 2. What's the difference between "cin and cout" and "scanf and printf"? 3. Why "cin.sync_with_stdio(false);"...
by hahahaken
Fri May 30, 2008 10:27 am
Forum: Volume 106 (10600-10699)
Topic: 10673 - Play with Floor and Ceil
Replies: 11
Views: 7025

Re:

You can simply separate this problem into two cases and discuss each of them: "k divides x" and "k does not divide x." BTW, you can also think about the modular. Modular is somehow related to the floor and the ceil function. This problem can be solved by very simple formula inst...
by hahahaken
Thu May 29, 2008 1:43 pm
Forum: Volume 106 (10600-10699)
Topic: 10673 - Play with Floor and Ceil
Replies: 11
Views: 7025

Re: 10673 - Play with Floor and Ceil

After I got wrong answers for 2 times, I search for google for some info and discover that those symbols are not brackets I misunderstood that the "floor" and "ceil" are brackets at first There are functions called floor and ceil in the math library in C++ which represent round d...
by hahahaken
Thu May 29, 2008 1:25 pm
Forum: Volume 106 (10600-10699)
Topic: 10673 - Play with Floor and Ceil
Replies: 11
Views: 7025

Re: 10673 - Play with Floor and Ceil

By solving the formula x = p (x/k) + q (x/k) x = (p+q) / k * x (p+q) / k = 1 p+q = k Sample input: 3 5 2 40 2 24444 6 Sample output: 1 1 <-- 1+1=2 1 1 <-- 1+1=2 0 6 <-- 0+6=6 But I have submitted for 2 times using different methods and both are wrong answer, I don't know why, can anyone please help ...
by hahahaken
Thu May 29, 2008 7:46 am
Forum: Volume 2 (200-299)
Topic: 272 - TEX Quotes
Replies: 136
Views: 40382

Re: 272 -WA-Plz help to debug it!!!

At last, I got AC, totally 7 tries, THANKS for everyone who has helped me b4 SPECIALLY THANKS for the AC of "dreadlord", it helps me to find out what's the differences between a AC and mine and debug I discovered that the trick is using, while(getline(cin,s,'\0')) then the program will kee...
by hahahaken
Thu May 29, 2008 7:09 am
Forum: Volume 2 (200-299)
Topic: 272 - TEX Quotes
Replies: 136
Views: 40382

Re: 272 -WA-Plz help to debug it!!!

I've tried to move the code used on file back to console mode, but wrong answer still occurs, why? I know how to use the "<<" and ">>", they are used to tell me where does the output start and where it ends. Is my WA related to "|" or anything else? Removed after AC
by hahahaken
Thu May 29, 2008 6:52 am
Forum: Volume 2 (200-299)
Topic: 272 - TEX Quotes
Replies: 136
Views: 40382

Re: 272 -WA-Plz help to debug it!!!

Finally, I can produce the correct input with a text file, but I don't know how to move back to the console, pls give me a help

Code: Select all

Removed after AC
by hahahaken
Wed May 28, 2008 1:50 pm
Forum: Volume 100 (10000-10099)
Topic: 10062 - Tell me the frequencies!
Replies: 235
Views: 44029

Re: 10062 - Tell Me the Frequencies!

This part will be just under gets() if(counter != 0) cout << endl; counter = 1; I finally figure out what's wrong with the blank line, those blank lines make my submission WA AGAIN and AGAIN, I finally got accepted, thank a lot P.S. The correct ouput should be like this AAABBC 67 1 66 2 65 3 122333...
by hahahaken
Wed May 28, 2008 1:12 pm
Forum: Volume 100 (10000-10099)
Topic: 10062 - Tell me the frequencies!
Replies: 235
Views: 44029

Re: 10062 - Tell Me the Frequencies!

Check the output producing system I gave above and print that way. I got accepted by editing this so why you won't get. :o Change the line cout << endl; into: int count =0; <<--at the starting of the program, (before while) if(count!=0) cout << endl; count =1; I follow your method to change but sti...
by hahahaken
Wed May 28, 2008 1:03 pm
Forum: Volume 2 (200-299)
Topic: 272 - TEX Quotes
Replies: 136
Views: 40382

Re: 272 -WA-Plz help to debug it!!!

Actually the most important thing I don't understand is that there are 2 versions of AC
One claims that just replace all " with `` and ' ' and you can get AC,
but another saying is that spaces and newlines have to be considered too
Which one is correct?
by hahahaken
Wed May 28, 2008 12:59 pm
Forum: Volume 2 (200-299)
Topic: 272 - TEX Quotes
Replies: 136
Views: 40382

Re: 272 -WA-Plz help to debug it!!!

Where should the below code added and what's the purpose?
I know how to output the spaces but I still don't manage to output line by line, I can just output a single continuous line, what else should I add?

Code: Select all

cout << "<<" << s << ">>"; 
by hahahaken
Wed May 28, 2008 12:54 pm
Forum: Volume 4 (400-499)
Topic: 488 - Triangle Wave
Replies: 270
Views: 38642

Re: 488 TLE

Those cin and cout are slow function. Remove them and use printf and scanf. The version you sent me also uses cin and cout, it's a AC, right? Mine is not just only exceeded for a few seconds, but at least 5 - 10s, coz I keep refreshing firefox and the status keep "running" until TLE appea...

Go to advanced search