what happens when r.x1>r.x2 or r.y1>r.y2 in your algorithm?
I think I handle all of these:
1) r.x1 > r.x2 => r2.x1 > min(r1.x2, r2.x2)
we know r2.x1 < r2.x2 so we must have r1.x2 < r2.x1 that I handle this.
2) r.y1 > r.y2 => max(r1.y1, r2.y1) > min(r1.y2, r2.y2)
suppose that min(r1.y2, r2.y2 ...
Search found 31 matches
- Thu Nov 15, 2007 5:34 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11345 - Rectangles
- Replies: 27
- Views: 11515
- Wed Nov 14, 2007 8:28 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11345 - Rectangles
- Replies: 27
- Views: 11515
- Tue Nov 13, 2007 10:41 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11352 - Crazy King
- Replies: 32
- Views: 17439
The problem statement said that a horse can move atmost 1 movement so you shouldn't mark the squares that horse can reach with 'Z' if you do it then horse can move more than 1 movement so you must mark reachable squares by horse with another character and be careful about squares that there exist a ...
- Tue Nov 13, 2007 8:23 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11345 - Rectangles
- Replies: 27
- Views: 11515
- Tue Nov 13, 2007 7:32 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11345 - Rectangles
- Replies: 27
- Views: 11515
Are you sure? I think the answer is 1 not 0. because two rectangles are the same.rio wrote:Try this.
INPUT:OUTPUT:Code: Select all
1 2 0 0 1 1 1 1 0 0
ADD : If you meet these kind of problems, try everything. Finding the trick is also the part of the problem.Code: Select all
Case 1: 0
----
Rio
- Tue Nov 13, 2007 2:50 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
- Mon Nov 12, 2007 12:22 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
- Mon Nov 12, 2007 11:41 am
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
- Mon Nov 12, 2007 11:23 am
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
Re: asd
how to used cin.get() ?
i used like this for input :
2
av
sd
scanf("%d\n",&m);
long total = 0;
while(m--){
unsigned char ch;
ch = cin.get();
cout << ch;
int cht = (int) ch;
}
but it prints nothing..and how to check the newline ?
thanks.
I think you must use cin instead of scanf because ...
i used like this for input :
2
av
sd
scanf("%d\n",&m);
long total = 0;
while(m--){
unsigned char ch;
ch = cin.get();
cout << ch;
int cht = (int) ch;
}
but it prints nothing..and how to check the newline ?
thanks.
I think you must use cin instead of scanf because ...
- Mon Nov 12, 2007 9:21 am
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
- Mon Nov 12, 2007 9:11 am
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
Re: Easy Fix
Yes, you can read in char !! It just may be negative.
Simply add a constant !!! (128 or bigger)
Please, remove your code as good etiquette if you get ac.
In the contest time they release a clarification:
Solution for each test case must be printed on a separate line.
I.e.
Code:
10.10$
10.11 ...
Simply add a constant !!! (128 or bigger)
Please, remove your code as good etiquette if you get ac.
In the contest time they release a clarification:
Solution for each test case must be printed on a separate line.
I.e.
Code:
10.10$
10.11 ...
- Sun Nov 11, 2007 8:57 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11340 - Newspaper
- Replies: 154
- Views: 68771
- Sun Nov 11, 2007 5:50 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11350 - Stern-Brocot Tree
- Replies: 6
- Views: 5309
I think you must use unsigned long long instead of int!
Code: Select all
struct rat
{
unsigned long long a, b;
};
- Mon Oct 08, 2007 10:25 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11309 - Counting Chaos
- Replies: 18
- Views: 10254
- Sun Oct 07, 2007 9:33 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11309 - Counting Chaos
- Replies: 18
- Views: 10254