lalakijilp (04-18-2010)
MPGHCC
Deadline of contest: April 27, 2010
Welcome to MPGH's Coding contest. The contest will contain 5 problems from which you must develop or alter an existing algorithm to solve the problem. For each problem you must code using either C/C++. All input is FILE ONLY. The file will contain 5 test cases and you must output 5 lines for the test cases. Output will be directly to screen and must match requirements word for word and punctuation correct. Code will be submitted separately and only the .cpp/.c file.
The marking system is as follows:
- You will get 20 points for every test case you get correct
- You will get 5 points for every day you submit earlier
Maximum Score: 600
Email: spaminator@live.ca
How to submit:
You will submit code with ONLY the .cpp/.c file. If you need to resubmit , add "[Resubmission]" to the end and you can only resubmit once.
To submit code, either PM me or e-mail me with the format as follows:
Subject: "Submission MPGHCC: [Your MPGH name] [Problem Number] [*Resubmission]"
Body:
Name: [Your name]
Age: [Your age]
Country: [Your country]
Example:
Subject:Submission MPGHCC: [zhaoyun333] [3]
Body:
Name: zhaoyun
Age: 15
Country: Canada
==================================================
Problem 1:
File Input: postcount.txt
MPGH needs a new post count system since most of it is spam. Count the number of posts each member has. Using the poster property of each post, count the posts made by each member.
Given N (1<N<100) number of total posts count the number of posts by each member. Print in order of first appearance.
Sample Input 1:
5
zhao
why06
retox
zhao
zhao
Sample Output 1:
zhao 3
why06 1
retox 1
Sample Input 2:
10
zhao
zhao
zhao
sealionne
why06
Dave
lala
zhao
zhao
why06
Sample Output 2:
zhao 5
sealionne 1
why06 2
Dave 1
lala 1
==================================================
Problem 2: Adding
File Input: "adding.txt"
Why06 needs help adding! He's forgot how to add really big numbers and multiple numbers at once!
Given a string of unknown numbers add them to find the sum. No number will be greater than 65536. Test cases will be separated by a newline.
Sample Input 1:
1+2+3+4+5
Sample Output 1:
15
Sample Input 2:
4+2+132+4
Sample Output 2:
142
==================================================
Problem 3: Birthday
File Input: "birthday.txt"
It's why06's birthday sometime soon and he want you to make a countdown for the day until his birthday! The problem is, you don't want to count the number of days, so you're going to compute it!
Given the current day, then month and why06s birthday in the same format, count the number of days until why06s birthday. Keep in mind leap years.
Sample Input 1:
1 1
1 2
Sample Output 1:
31
Sample Input 2:
12 30
1 1
Sample Output 2:
2
==================================================
Problem 4: CreditCard
File Input: "credit.txt"
Many hackers on MPGH have been using stolen credit cards to buy hacks. Why06 has instructed you to determine if the credit card is stolen or not. If it is stolen output who could have stole it. A credit card has a special private number that is prime, and the bank also has a special prime number.
Given a number N, if it only has two prime factors, than it is a legal credit card. But if the number has more than two prime factors, output all the prime factors of the number in ascending order to determine the user of the card.
Sample Input 1:
15
Sample Output 1:
Legit Card! Id 3 and 5.
Sample Input 2:
30
Sample Output 2:
Illegal Card! Ids 2,3,5.
==================================================
Problem 5: Ip Track
File Input: "iptrack.txt"
A hacker is using multiple servers to mask his IP Address, while doing a trace it was discovered that there are a bunch of false paths that lead to dead paths. To find where the server is, the deepest part of the network will lead to him. Two connections might point to the same server. Be careful of cycles that the hacker might have created!
Given N (1<N<100) number of servers and S number of connections , find the deepest path in the network and output the longest distance. 1 will be the MPGH server or the starting point.
Sample Input 1:
5
4
1 2
2 3
3 4
4 5
Sample Output 1:
4
Sample Input 2:
6
6
1 2
2 3
3 1
2 4
4 5
5 6
Sample Output 2:
4
Attached are the sample test data as requested. There are only 2 test cases in there each but when I mark there will be 5.
Last edited by zhaoyun333; 04-18-2010 at 08:23 AM.
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi
lalakijilp (04-18-2010)
soooooo what do you get if you complete this???
Knowledge. Knowing what you are capable of ?
I'll get to work on this tomorrow morning when I get back.
zhaoyun333 (04-17-2010)
K you have about 10 days to finish it, but you can still grab the bonus points for early submission.
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi
submitted mine, good luck other people
this time I didn't just go for the bonus points :P
edit: @ zhayoun: Ill finish the rest tomorrow if I can be arsed
Ah we-a blaze the fyah, make it bun dem!
hmm.. i really need to go back again to C, actually advance to C++, and this might be a good restart but damt, im just having too much stuff to do this weeks..
Last edited by 'Bruno; 04-17-2010 at 07:18 PM.
Light travels faster than sound. That's why most people seem bright until you hear them speak.
Oh wow, I would try to do this, but I have such hardtimes adding really big numbers like 1+2+3+4+5 @_@. I dunno if I can do this coding thing. Brain hurts.. owww! ;(
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
Hell_Demon (04-18-2010)
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi
why06 (04-18-2010)
Can't be arsed
I hope my final score is enough to defeat these infidels
Ah we-a blaze the fyah, make it bun dem!
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
i want to do this only im doing it with C# but (There is always one here in holland),i am to bussy T_T nani kuraii.
@ Anime Section,Otaku/weeabo (orz.) @Graphics Section, Novice DigiArtist
neuest gift from Yura~Chan:
https://bakyurayuu.deviantar*****m/#/d372taw
2nd Place MOTM#9 Theme: CharMods - Combat Arms [No - Thanks] button
come on you know that don't want to push that ordinary button
Sorry for double posting but error on number 3, its the month first then the day for the input. Sorry about that.
For clarification on number 5, given a set of ponits (1 being the start) that are connected. Find the longest path from the starting point to another point. Beware of loops
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi