Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125

    [MPGH Coding Contest #2]

    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

  2. The Following User Says Thank You to zhaoyun333 For This Useful Post:

    lalakijilp (04-18-2010)

  3. #2
    bckup_iopop9's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    42
    Reputation
    12
    Thanks
    3
    soooooo what do you get if you complete this???

  4. #3
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,881
    Reputation
    163
    Thanks
    3,291
    My Mood
    Sleepy
    Knowledge. Knowing what you are capable of ?

    I'll get to work on this tomorrow morning when I get back.

  5. The Following User Says Thank You to Crash For This Useful Post:

    zhaoyun333 (04-17-2010)

  6. #4
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    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

  7. #5
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    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!

  8. #6
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    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.

  9. #7
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    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

  10. The Following User Says Thank You to why06 For This Useful Post:

    Hell_Demon (04-18-2010)

  11. #8
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    Quote Originally Posted by why06 View Post
    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! ;(

    XD LOL WHY. Sorry I wasn't too creative making up these question scenarios, but since this is kinda the question you got me to add it put you in it. ^ ^
    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

  12. The Following User Says Thank You to zhaoyun333 For This Useful Post:

    why06 (04-18-2010)

  13. #9
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    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!

  14. #10
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    Quote Originally Posted by Hell_Demon View Post
    Can't be arsed

    I hope my final score is enough to defeat these infidels
    Pretty sure you will with your 260 point lead.
    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

  15. #11
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by zhaoyun333 View Post
    Pretty sure you will with your 260 point lead.
    260 points! are you kidding me? -___-

    Well, idk this seems easier I can try.

    "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

  16. #12
    Kuro Tenshi's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Where arth thou be
    Posts
    3,635
    Reputation
    70
    Thanks
    746
    My Mood
    Blah
    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.
    DigiDrawing|+ ( (Elfen Archer) )
    Link:
    https://www.mpgh.net/forum/148-showro...en-archer.html


    @ 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

  17. #13
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by why06 View Post
    260 points! are you kidding me? -___-

    Well, idk this seems easier I can try.
    Two pieces submitted, both correct, 10 day bonus
    submit 3 correctly and you win
    Ah we-a blaze the fyah, make it bun dem!

  18. #14
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    Quote Originally Posted by Hell_Demon View Post
    Two pieces submitted, both correct, 10 day bonus
    submit 3 correctly and you win
    But aren't you going to try the other 3? D=
    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

  19. #15
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    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

Page 1 of 2 12 LastLast

Similar Threads

  1. MPGH Coding Contest!
    By zhaoyun333 in forum C++/C Programming
    Replies: 61
    Last Post: 04-07-2010, 04:01 PM
  2. MPGH Video Contest Winners
    By radnomguywfq3 in forum News & Announcements
    Replies: 56
    Last Post: 01-21-2009, 07:11 PM
  3. [Video] MPGH Video Contest 2
    By LazyCountry in forum Combat Arms Hacks & Cheats
    Replies: 26
    Last Post: 09-01-2008, 10:43 PM
  4. [Video] MPGH Video Contest
    By LazyCountry in forum Combat Arms Hacks & Cheats
    Replies: 14
    Last Post: 08-31-2008, 04:55 PM
  5. MPGH VIP CONTEST - Custom Emotions
    By arunforce in forum Hack/Release News
    Replies: 1
    Last Post: 04-08-2007, 08:23 AM