Search found 31 matches

by saman_saadi
Sun Oct 07, 2007 1:34 pm
Forum: Volume 113 (11300-11399)
Topic: 11309 - Counting Chaos
Replies: 18
Views: 6795

When determining if HH:MM is palindromic, ignore all leading zeroes in HH. If HH is zero then ignore all leading zeroes in MM. according to the statement for determining if 01:21 is palindromic, we must ignore all leading zeroes in 01 so we have 1:21. it's obvious that 121 is palindromic. The same ...
by saman_saadi
Sat Oct 06, 2007 10:58 pm
Forum: Volume 113 (11300-11399)
Topic: 11310 - Delivery Debacle
Replies: 19
Views: 9850

Thanks Robert Gerbicz. I got AC. It's too bad that I couldn't consider this case :oops: Thanks again.
by saman_saadi
Sat Oct 06, 2007 10:03 pm
Forum: Volume 113 (11300-11399)
Topic: 11310 - Delivery Debacle
Replies: 19
Views: 9850

11310 - Delivery Debacle

This problem was the easiest one and many people solve it in the contest time But I don't know why I can't solve it! I use dp: suppose f(i) is the number of 2-by-i box (width = 2 and length = i) so we have: f(i) = 4 * f(i - 2) + f(i - 1) f(i) = 1 if i = 0 f(i) =0 if i < 0 There are four possibilitie...
by saman_saadi
Sat Oct 06, 2007 5:37 pm
Forum: Volume 113 (11300-11399)
Topic: 11309 - Counting Chaos
Replies: 18
Views: 6795

Try this:

input:

Code: Select all

5
23:59
01:20
01:09
00:08
00:22
output:

Code: Select all

00:00
01:21
01:11
00:09
00:33
by saman_saadi
Mon Aug 13, 2007 3:44 pm
Forum: Volume 101 (10100-10199)
Topic: 10180 - Rope Crisis in Ropeland!
Replies: 39
Views: 21492

I generate about 1000 testcase and compare your code with my AC code and two files are equal :o
I don't know why you got WA but I like your idea (using dot product) because it guarantee that always the arc length will be minimum. I think the judge input maybe wrong, I'm not sure.
by saman_saadi
Sat Aug 04, 2007 10:43 am
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

I thought the IEEE standard for double precision floating point numbers requires them to represent 52bit fractional digits. So it follows that they can represent every 32bit integers exactly. However, some decimal such as 0.1 don't have a finite base 2 representation, so they can't be represented e...
by saman_saadi
Fri Aug 03, 2007 10:29 pm
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

1) Don't use float, double, long double (same as double in some compilers) as sentinel. for example: double i; for (i = 0; i < 3; i++) //dangerous code { } you declare t as long double. In my compiler your program didn't terminate so you must declare t as int. 2) I think you don't understand the rec...
by saman_saadi
Thu Aug 02, 2007 9:02 pm
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

You don't need BigInt. "int" is enough because n <= 1000000 < 2 ^ 31 - 1 You don't say anything about your algorithm but you can use emotional blind recurrence: AFAIK it should be like this f(n,i) = n/(k^i) - f(n, i+1) Result is: f(n,0) SPOILER?? Think about the recurrence. why it's true and what it...
by saman_saadi
Wed Aug 01, 2007 10:43 pm
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

If you mean the output become 0, I must say "no!" Because n >= 1 and k >= 2 so we always can select at least one number
by saman_saadi
Sun Jul 29, 2007 6:11 pm
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

Thanks emotional blind for your nice recurrence

Code: Select all

Deleted
Thanks for your help :P
by saman_saadi
Sun Jul 29, 2007 3:11 pm
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

Thanks for your reply sclo. Can you give me some hint? I saw Double-Free Set recurrence that works for k = 2:

Code: Select all

f(n) = ceil(n / 2) + f(floor(n / 4))
But how above recurrence work?
by saman_saadi
Sun Jul 29, 2007 7:03 am
Forum: Volume 112 (11200-11299)
Topic: 11246 - K-Multiple Free set
Replies: 16
Views: 5744

11246 - K-Multiple Free set

Hi I got AC this question in the contest time but when this question added in online judge problemset I got TLE. What's Wrong? My algorithm is: I first select the numbers that is not the factor of k then consider the factors of k. suppose x is a factor of k (x = ak) if I selected a or a is belong to...
by saman_saadi
Thu Jun 21, 2007 1:43 pm
Forum: C++
Topic: Why we can use "while(cin >> a)"
Replies: 6
Views: 3075

Krzysztof Duleba right there is a converstion operator. for example: #include <iostream> using namespace std; struct test { int a; }; int main() { test a; while (a) // Syntax error { } return 0; } but if you define a conversion operator the code will be correct: #include <iostream> using namespace s...
by saman_saadi
Thu Jun 21, 2007 1:28 pm
Forum: C++
Topic: 2D string array for STL sort
Replies: 3
Views: 2717

I think you cannot use two dimensional array in sort function: int a[3][2] = {{1, 2}, {3, 4}, {5, 6}}; sort(a, a + 3); // Syntax eror for solving this problem you must use vector: #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; void print(vector<stri...
by saman_saadi
Thu Jun 21, 2007 11:17 am
Forum: C++
Topic: EBook for C++
Replies: 1
Views: 1626

You can download "Thinking in C++" by Bruce Eckel from:

http://www.mindview.net/Books/DownloadSites/

Go to advanced search