Coding Contest - April 14, 2012

From syn2cat - HackerSpace.lu
Revision as of 15:26, 14 April 2012 by The metalgamer (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Note: this article is about a passed event.
Add your Event
Event.png
Coding Contest - April 14, 2012
Prove your skill in coding, to solve difficult and not so difficult challenges.
Syn2code.jpg
Type of Event: Event
From: 2012/04/14 14:30
Till: 2012/04/14 20:00
Recurring: no
Organizer: syn2cat
Cost: 0 EUR0 $
0 £
0 CHF
Mandatory registration:


Attendees: Destructive, Kwisatz, Lala, Xenplex
Log-in to RSVP
Contact Person(s): Destructive (mail)
Keywords: coding, contest, programming
Location
Where: Hackerspace, Strassen (11, rue du Cimetière, L-8018 Strassen, Luxembourg)
Map:
Loading map...
Tools
QrCode: QR-38b789b960a3f8b12aa3929f3abc9dc4.png
Add to your calendar: Download … further results
Alternate picture: View
Announce globally: yes
There will be challenges with varying skill levels. You can use the programming language you want to solve them. If you're not so talented in coding yet, don't be afraid! There will certainly be friendly people around to help you.



The goal of this contest is not to find the best coder, but to enjoy coding together and to motivate others to start coding. If you can write a "hello world" program in any language, you are welcome. There will be certainly someone to help you to solve the tasks.

We will use the following example problem to make us familiar with the contest system.


Contents

[edit] Sample problem

Mr. Foo has to determine if his students have passed the year. As he has many students which have written many tests, he can't use his calculator, because it would take him too long. He knows that you are a skilled hacker, so he has asked you to make a program to automate his task.

He has S students. Each student has written N tests. The test scores ranges from 0 to 60 (both inclusive). A student has passed his year if he has an average score of more or equal to 30. The average is not rounded.


[edit] Input

You are given an input file. The first line consists of 2 integers: the number of students S (1 <= S <= 1000) and the number of tests N (1 <= N <= 1000). S lines follow, which consists of N integers, representing the scores of a student.


[edit] Output

You have to create an output file which contains one line per student. Each containing 'PASSED' if he has passed his year, otherwise 'FAILED'.


[edit] Input example

4 2
29 30
30 30
50 60
0 58

[edit] Output example

FAILED
PASSED
PASSED
FAILED

[edit] python3

with open("marks.txt") as f:
    students, tests = f.readline().split(" ")
    lines = f.read().split("\n")[0:-1]
with open("results.txt",'w') as f2:
    for values in lines:
        f2.write("Failed\n" if (sum([int(i) for i in values.split(" ")])) / int(tests) < 30 else "Passed\n")

---

$ python3 marks.py
$ cat results.txt
Failed
Passed
Passed
Failed
$ wc -c marks.py
284 marks.py


[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
syn2cat
Hackerspace
Activities
Initiatives
Community
Tools
Tools