Search found 33 matches

by 20717TZ
Mon Jul 09, 2018 12:40 am
Forum: Volume 5 (500-599)
Topic: 508 - Morse Mismatches
Replies: 3
Views: 4322

Re: 508 - Morse Mismatches

Indeed, that's what I got for the sample input, but my output is different from the sample output:

Code: Select all

WHAT
HATH
GOD
WROTH?
WHAT
AN
EARTHQUAKE
IM!
READY
TO
IM!
by 20717TZ
Sun Jul 08, 2018 5:02 am
Forum: Volume 15 (1500-1599)
Topic: 1590 - IP Networks
Replies: 1
Views: 7919

Re: 1590 - IP Networks

Get wrong answer, really don't know where the code fails for which special cases? :oops:


/* 1590 - IP Networks
Author: Peter Lee
Contact: leestime.com <at> gmail.com
Algorithm: bitwise
Notes:
*/
#include <cstdio>
#include <iostream>
#include <vector>
#include <bitset>
#define N 32
using ...
by 20717TZ
Mon Jan 26, 2015 5:34 am
Forum: Volume 111 (11100-11199)
Topic: 11150 - Cola
Replies: 43
Views: 30328

Re: 11150 - Cola

If you guys think this problem from a different perspective, it's super easy:

/* 11150 - Cola
Author: Peter Lee
Contact: leestime.com <at> gmail.com
Algorithm: ad-hoc
Notes: 1. Let:
x = The price of an empty bottle
y = The price of the drink only in a bottle
Then:
x + y = 3*x => y = 2*x
2 ...
by 20717TZ
Sat May 24, 2014 9:36 pm
Forum: Volume 100 (10000-10099)
Topic: 10013 - Super long sums
Replies: 212
Views: 67607

Re:

tenshi wrote:check this case:

1

4
0 9
0 9
0 9
1 9
This is an invalid input, because
Each of the two given integers is not less than 1, and the length of their sum does not exceed M.
by 20717TZ
Tue Oct 22, 2013 5:53 am
Forum: Volume 102 (10200-10299)
Topic: 10298 - Power Strings
Replies: 31
Views: 19270

Re: 10298 - Power Strings

OK. I switched to use the native C function strstr, and it got accepted, which does NOT make too much sense!

http://stackoverflow.com/questions/19506571
by 20717TZ
Mon Oct 21, 2013 9:46 am
Forum: Volume 102 (10200-10299)
Topic: 10298 - Power Strings
Replies: 31
Views: 19270

Re: 10298 - Power Strings

There's Knuth-Morris-Pratt algorithm. Find using it position of the first occurrence of s in string s*s.

I used the same strategy, but still got TLE, I believe my algorithm is O(n):

inline int GetLargestN(const char* cs)
{
string s(cs);
string ss(s, 1); ss += s; ss += s[0];

int len = s ...
by 20717TZ
Fri Oct 04, 2013 3:21 am
Forum: Bugs and suggestions
Topic: 895 - Word Problem - Backend Is WRONG
Replies: 5
Views: 4423

Re: 895 - Word Problem - Backend Is WRONG

NO. they should NOT be counted multiple times in the output. because the problem description clearly states
number of DIFFERENT words
by 20717TZ
Thu Oct 03, 2013 10:18 am
Forum: Bugs and suggestions
Topic: 895 - Word Problem - Backend Is WRONG
Replies: 5
Views: 4423

895 - Word Problem - Backend Is WRONG

In the problem description, it states very clearly:

For each puzzle line in the input, a single line of output should be produced, containing the number of DIFFERENT words in the dictionary that can be formed using the letters in the puzzle line.

My code runs with the following input:
ant
bee ...
by 20717TZ
Thu Oct 03, 2013 9:56 am
Forum: Volume 8 (800-899)
Topic: 895 - Word Problem
Replies: 23
Views: 16448

Re: 895 - Word Problem

sample
hello
this
hiso
csedu
dhaka
niceprob
rivers
cricket
acm
acm
this
string
c
you
#
a c c c h i m
s r w d d g d
h s a i o c m
c a q r t r r
h l l y o o u
#

output:
3
0
4
1
1

I think it should be:
2
0
3
1
1

Because in the problem description, it states very clearly:

For each puzzle ...
by 20717TZ
Thu Oct 03, 2013 9:50 am
Forum: Volume 8 (800-899)
Topic: 895 - Word Problem
Replies: 23
Views: 16448

Re:


Do you consider the case that same word may appear more than once
in the dictionary ?


You mean the dictionary can contain the same word twice.

For example :

cat
cat
dog
lion
#
c a t
#

will output 2.

I applied the method that .. mentioned and got AC.. but still can't figure out why the ...
by 20717TZ
Sat Sep 28, 2013 10:50 am
Forum: Volume 7 (700-799)
Topic: 755 - 487--3279
Replies: 115
Views: 47371

Re: 755 always SubmmisionErr

I am having the same problem. It's always submission error.

I also tried to submit a different problem and then came back to submit 755, but I still got the same problem.

Please take a look at it.
by 20717TZ
Wed Sep 25, 2013 9:00 am
Forum: Volume 105 (10500-10599)
Topic: 10579 - Fibonacci Numbers
Replies: 8
Views: 6844

Re: 10579 - Fibonacci Numbers

0 should not be in the test data;
The maximum input: 4786 (f(4786) has 1000 digits, while f(4787) has 1001 digits)

Test Input:
4786
3
100
20
1
2
3
4
4781
43
44
45
46

Test Output ...
by 20717TZ
Thu Feb 21, 2008 4:53 am
Forum: Volume 7 (700-799)
Topic: 708 - Dreisam Equations
Replies: 10
Views: 4752

And should I also take the inbalance parenthesis into account, if it's required, this problem would be so complicated.

thanks everyone, can someone reply?

I spent a lot of time in this problem, and my code can get this input lines worked:
(There are '\t' or spaces in or in the end of the input ...
by 20717TZ
Tue Feb 19, 2008 7:47 pm
Forum: Volume 100 (10000-10099)
Topic: 10023 - Square root
Replies: 121
Views: 45310

I'm sorry. I forgot to change this line:

Code: Select all

 FILE* fp=fopen("Input.txt","r"); 
To:

Code: Select all

 FILE* fp=stdin; 
Everytime I need to make this change before submission.

However, I'm now using this:

Code: Select all

#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
#endif
by 20717TZ
Mon Feb 18, 2008 1:20 pm
Forum: Volume 7 (700-799)
Topic: 708 - Dreisam Equations
Replies: 10
Views: 4752

I think the concept is fairly simple. Convert infix notation to postfix notation. Then using the postfix notation, parse it and anytime there's supposed to be an operator, recusively plug in either +, - and *.

I think the concept is not so clear!

708 - Dreisam Equations - SampleOutput is EVEN ...

Go to advanced search