Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 CCC 2006
Index -> Contests
Goto page Previous  1, 2, 3, 4  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MysticVegeta




PostPosted: Wed Mar 01, 2006 6:28 pm   Post subject: (No subject)

Thanks a lot Jack!!! Razz
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Wed Mar 01, 2006 6:31 pm   Post subject: (No subject)

i did only 3 out of the 5 questions because of time issues and we had to write on a laptop which kept minimizing my programs for some odd reason. i think the touch pad was way to sensitive. anyways
which one do u want me to give u guys b/c i'm not goin to type all the questions out and i don't have a scanner.

here's the one i found difficult understanding. problem 4

here is a list for you left just this morning by your parents
1. do your math homework
2.call your grandma
3.call me at work
4. call your friends
5.feed the dog
7. let the dog out. watch television

your parent given u constraints on these tasks:

1.do your math work before u watch tv
2.do math homework before u call your friend
3.call grandma before u do math homework
4.call me at work before u call friend
5.feed the dog after u call me at work

your to do list can be abbreviated to:
1,7
1,4
2,1
3,4
3,5

x,y represent the task numbered x should be done before task numbered y

additional insturctions are emailed to u by your parent. write programto use original to do list and the additional instructions to output a list of your jobs in order u must do them, or alternately, if u cannot comlete them, u should output that there is no way to complete these tasks, and u r just going to bed

input specifications
u will be given pairs of numbers, one number per line, to represent the additional instructions to be included with your original to do list. the data terminates with the input pair 0 and 0. u can assume that there will be at most 10 additional constarints

output specifications
u should output a list of tasks in orfetr that they should be performed or an error message saying that the tasks cannot be completed. if there r multiple orders in which the tasks may be completed, the following tie breaking rule must be used:

if there is set of taks which may be performed at the same time during the process, the smallest numbered taks should be performed first.

sample input
6
2
5
4
0
0

[/b]output
3 5 6 2 1 4 7

explanation for output
the input data tells us that task 6 must be performed before task 2, and task 5 before taks 4. the only tasks with no prerequisites are 3 and 6, so we choose 3 because it has the lower number. then 5 and 6 are possible; 5 is chosen, then 6. next must come 2, followed by 1. then both 4 and 7 are possible; the lower one is chosen first.

-------------------------------------------------------------------------------------

P.S. whoever solves it pleases post answer i wanna see how u did it. thanks.
MysticVegeta




PostPosted: Wed Mar 01, 2006 6:50 pm   Post subject: (No subject)

=\ its really hard to understand it like this, I wil wait for Jack to scan them.
cool dude




PostPosted: Wed Mar 01, 2006 7:16 pm   Post subject: (No subject)

its actually almost exactly word by word how it said on the contest. thats why i said its really difficult to understand it and i had to read it quite a lot of times to get it. read it over a couple times u might get it. that was prolly one of the hardest ones. the first 2 were the easiest ever. especially the second one because it was like 12 lines.
JackTruong




PostPosted: Wed Mar 01, 2006 7:33 pm   Post subject: (No subject)

That question was part of the junior set, which I'll try my best to scan in later.

Senior problems are up:

Question 1: [Page 1] [Page 2]
Question 2: [Page 1] [Page 2]
Question 3: [Page 1] [Page 2]
Question 4: [Page 1] [Page 2]
Question 5: [Page 1] [Page 2]
Package: CCC Senior 2006
MysticVegeta




PostPosted: Wed Mar 01, 2006 7:44 pm   Post subject: (No subject)

cool thanks
MysticVegeta




PostPosted: Wed Mar 01, 2006 8:05 pm   Post subject: (No subject)

Heh lol, if I was still doing turing, I see #3 getting easily coded with whatdotcolor
Paul




PostPosted: Wed Mar 01, 2006 9:03 pm   Post subject: (No subject)

Number 2, no one in my school had all the cases, because of one case:

They expect you to know that if 25 letters has been found, the last one will automatically be known. Say you have a message and a cypher, with 25 letters of the alphabet, then given a message with 26 letters, they expect you to know the last letter, because all others are known. I know some people at other schools got this, just not mine. Tricky CCC people -_-

Its really easy in turing, discounting the one case, even so, its easily solved with an array of the letters found and the alphabet I suppose, its easy to do but no one here thought of it, including me:
here's my number 2 anyway, just posting it because I'm sure there are people who can do the other solutions much better than I did
code:

var filename : string := "s2.in"
var fileno : int

open : fileno, filename, get

var TexT : string
var Cypher : string
var Code : string

get : fileno, TexT : *
get : fileno, Cypher : *
get : fileno, Code : *
for a : 1 .. length (Code)
    if index (Cypher, Code (a)) not= 0 then
        put TexT (index (Cypher, Code (a))) ..
    else
        put "." ..
    end if
end for
close (fileno)
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Wed Mar 01, 2006 9:04 pm   Post subject: (No subject)

MysticVegeta wrote:
Heh lol, if I was still doing turing, I see #3 getting easily coded with whatdotcolor

No, it cannot, since the lines probably do not cross on an integer point, there is no rule saying they must. And whatdotcolor can only check each pixel, limiting the accuracy. I thought about it too. It could probably be done given an infinite resolution.

All I did was write a function checking if 2 lines intersect, passing in the coordinates of the start and end of each line. So you check each edge of each building with the line itself. Its probably not the best way.

Also you need to include cases like divide by zero, if you're using y=mx+b, and lines with the same slope.

Unfortunately I was rushed, and I was off by 1 in every test case, my teacher says.
Cervantes




PostPosted: Wed Mar 01, 2006 9:07 pm   Post subject: (No subject)

That would involve drawing to the screen. You're only supposed to display the final answer to the screen. Would that be illegal?
Paul




PostPosted: Wed Mar 01, 2006 9:08 pm   Post subject: (No subject)

I dunno, not if it draws in the background I suppose, as long as you have the answers on screen. BUT as I said, it probably wouldn't work unless for the simplest cases.
MysticVegeta




PostPosted: Wed Mar 01, 2006 11:00 pm   Post subject: (No subject)

Cervantes wrote:
That would involve drawing to the screen. You're only supposed to display the final answer to the screen. Would that be illegal?


Why yes it does, but there is no rule saying, you are not allowed to open a window and then close it Laughing
MysticVegeta




PostPosted: Wed Mar 01, 2006 11:01 pm   Post subject: (No subject)

Paul wrote:
MysticVegeta wrote:
Heh lol, if I was still doing turing, I see #3 getting easily coded with whatdotcolor

No, it cannot, since the lines probably do not cross on an integer point, there is no rule saying they must. And whatdotcolor can only check each pixel, limiting the accuracy. I thought about it too. It could probably be done given an infinite resolution.

All I did was write a function checking if 2 lines intersect, passing in the coordinates of the start and end of each line. So you check each edge of each building with the line itself. Its probably not the best way.

Also you need to include cases like divide by zero, if you're using y=mx+b, and lines with the same slope.

Unfortunately I was rushed, and I was off by 1 in every test case, my teacher says.


Do the test cases require it to be "that" accurate that a pixel cant cover it?
Paul




PostPosted: Wed Mar 01, 2006 11:33 pm   Post subject: (No subject)

Hm, actually, now that I think about it, give it a try. It can be done. But in my opinion, in order for you to get it accurate enough, its not any easier than the math method of doing things.

1. The way you'll follow the lines to check for intersections
2. Accuracy, if you're on a 800x600 resolution, you'll only have such amount of grid points. But considering the restrictions they give you, it should be able to work somewhat.
3. what if they gave you the max number of buildings with like 30 sides each? it'll get pretty complex with whatdotcolor. Hint: there are only like 5 test cases though, and the number of sides never went past 8 or 10 I believe.

I still suggest doing it with math though.
MysticVegeta




PostPosted: Thu Mar 02, 2006 1:32 am   Post subject: (No subject)

Well ofcourse I will do it the math way, cause I am doing it in java, I was just suggesting an idea and bringing up andy in the discussion and I am sure he would love my suggestion LOL.
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 4  [ 55 Posts ]
Goto page Previous  1, 2, 3, 4  Next
Jump to:   


Style:  
Search: