Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
treffen:codegolfing:005 [2020/11/25 20:13] max |
treffen:codegolfing:005 [2022/07/01 18:56] (aktuell) marc_weber [PHP] ist Python |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | [[treffen:codegolfing|CodeGolfings]] | + | {{:treffen:problemsolving: |
| - | ====== 005 Code Golfing | + | [[https:// |
| - | | Submission due: | Sat. Nov 28th 2020 at 3pm| | ||
| - | | Event: | ||
| - | | Details: | {{ : | ||
| - | | Venue: | online; link will be published here beforehand | | ||
| - | | Contact: | max at vspace.one | | ||
| - | NOTE: Previous description: | + | ====== 005: Colorized Rummy ====== |
| - | Current number of submissions: **6** | + | | Series | [[treffen:codegolfing|CodeGolfings]] | |
| - | + | | Submission due | |
| - | ===== Scoring ===== | + | | Event |
| - | ^ Lang ^ Bytes ^ | + | | Details |
| - | | python | + | | Venue | [[https:// |
| - | | perl | 86B | | + | | Contact |
| - | | php | 105B | | + | | Difficulty | {{: |
| - | | python | + | |
| - | | python | + | |
| - | | java | 1710B | | + | |
| + | NOTE: Previous description: | ||
| ===== (some) Testcases ===== | ===== (some) Testcases ===== | ||
| Zeile 34: | Zeile 27: | ||
| { " | { " | ||
| { " | { " | ||
| - | { " | + | { " |
| + | { " | ||
| + | { " | ||
| + | { " | ||
| ] | ] | ||
| </ | </ | ||
| ===== Solutions ===== | ===== Solutions ===== | ||
| + | |||
| + | ==== Ruby (>=2.7) ==== | ||
| + | 69B, max | ||
| + | |||
| + | Beschreibung: | ||
| + | |||
| + | < | ||
| + | s=$*[0].chars.tally.values+[0, | ||
| + | exit(s[3]> | ||
| + | </ | ||
| + | |||
| + | ==== Python ==== | ||
| + | 83B, chris | ||
| + | |||
| + | < | ||
| + | import sys | ||
| + | a, | ||
| + | 1/ | ||
| + | </ | ||
| + | |||
| + | ==== Python ==== | ||
| + | 85B, max | ||
| + | |||
| + | < | ||
| + | import sys | ||
| + | c=sorted([sys.argv[1].count(x)for x in" | ||
| + | exit(c[0]< | ||
| + | </ | ||
| + | |||
| + | ==== Perl ==== | ||
| + | 86B, max | ||
| + | |||
| + | < | ||
| + | for(yrbk=~/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Python ==== | ||
| + | 172B, m0rix | ||
| + | |||
| + | < | ||
| + | import sys | ||
| + | i=sys.argv[1] | ||
| + | l=sorted([i.count(" | ||
| + | while l[0]!=l[3]and l[0]>=0: | ||
| + | | ||
| + | exit(l[0]!=l[3]) | ||
| + | </ | ||
| + | |||
| + | ==== Python ==== | ||
| + | 226B, nikax | ||
| + | |||
| + | < | ||
| + | import sys | ||
| + | x=sys.argv[1] | ||
| + | y=[] | ||
| + | for l in [' | ||
| + | y.sort() | ||
| + | o=1 | ||
| + | while y[0]!=0: | ||
| + | if y[2]< | ||
| + | elif y[1]< | ||
| + | else:break | ||
| + | y[0]-=1 | ||
| + | if(y[1]==y[2]==y[3]): | ||
| + | exit(o) | ||
| + | </ | ||
| + | |||
| + | ===== Tests not passed ===== | ||
| + | |||
| + | |||
| + | ==== PHP ==== | ||
| + | 105B, marc | ||
| + | |||
| + | < | ||
| + | <?php $s=$argv[1]; | ||
| + | </ | ||
| + | |||
| + | ==== Java ==== | ||
| + | 1.7KB, alexander | ||
| + | |||
| + | < | ||
| + | |||
| + | import java.util.*; | ||
| + | import java.util.concurrent.ConcurrentHashMap; | ||
| + | |||
| + | public class Alex { | ||
| + | |||
| + | private static ConcurrentHashMap< | ||
| + | private static ConcurrentHashMap< | ||
| + | |||
| + | public static void main(String[] args) { | ||
| + | |||
| + | for (char c : args[0].toCharArray()) { | ||
| + | if (!(c == ' | ||
| + | chars.put(chars.size(), | ||
| + | } | ||
| + | |||
| + | lists.put(0, | ||
| + | lists.get(0).add(chars.get(0)); | ||
| + | chars.remove(0); | ||
| + | |||
| + | for (int i : chars.keySet()) { | ||
| + | for (int j : lists.keySet()) { | ||
| + | if (!lists.get(j).contains(chars.get(i)) && lists.get(j).size() < 3) { | ||
| + | lists.get(j).add(chars.get(i)); | ||
| + | chars.remove(i); | ||
| + | } else if (chars.size() >= 3 && isEverythingMin()) { | ||
| + | lists.put(lists.size(), | ||
| + | lists.get(lists.size() - 1).add(chars.get(i)); | ||
| + | chars.remove(i); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | for (int k : lists.keySet()) { | ||
| + | for (int l : chars.keySet()) { | ||
| + | if (!lists.get(k).contains(chars.get(l))) { | ||
| + | lists.get(k).add(chars.get(l)); | ||
| + | chars.remove(l); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | System.out.println((chars.size() > 0 ? " | ||
| + | } | ||
| + | |||
| + | private static boolean isEverythingMin() { | ||
| + | for(int i : lists.keySet()) { | ||
| + | if(lists.get(i).size() < 3) { | ||
| + | return false; | ||
| + | } | ||
| + | } | ||
| + | return true; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Außer Konkurrenz ===== | ||
| + | ==== Python ==== | ||
| + | 78B, chris,max | ||
| + | |||
| + | <code Python> | ||
| + | import sys | ||
| + | a, | ||
| + | 1/ | ||
| + | </ | ||
| + | |||
| ===== Preformance Award ===== | ===== Preformance Award ===== | ||
| + | |||
| + | **FOLGT** | ||
| ~~DISCUSSION~~ | ~~DISCUSSION~~ | ||