This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Alfredo Spaghetti really likes soup, especially when it contains alphabet pasta. Every day he constructs a sentence from letters, places the letters into a bowl of broth and enjoys delicious alphabet soup. | |
Today, after constructing the sentence, Alfredo remembered that the Facebook Hacker Cup starts today! Thus, he decided to construct the phrase "HACKERCUP". As he already added the letters to the broth, he is stuck with the letters he originally selected. Help Alfredo determine how many times he can place the word "HACKERCUP" side-by-side using the letters in his soup. | |
Input | |
The first line of the input file contains a single integer T: the number of test cases. T lines follow, each representing a single test case with a sequence of upper-case letters and spaces: the original sentence Alfredo constructed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
We are starting preparations for Hacker Cup 2013 really early. Our first step is to prepare billboards to advertise the contest. We have text for hundreds of billboards, but we need your help to design them. | |
The billboards are of different sizes, but are all rectangular. The billboard widths and heights are all integers. We will supply you with the size in inches and the text we want printed. We want you to tell us how large we can print the text, such that it fits on the billboard without splitting any words across lines. Since this is to attract hackers like yourself, we will use a monospace font, meaning that all characters are of the same width (e.g.. 'l' and 'm' take up the same horizontal space, as do space characters). The characters in our font are of equal width and height, and there will be no additional spacing between adjacent characters or adjacent rows. If you print a word on one line and print the next word on the next line, you do not need to print a space between |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zope.component import adapts | |
from Products.Archetypes.interfaces import IObjectPostValidation | |
from Products.PythonScripts.standard import html_quote | |
from Products.CMFCore.utils import getToolByName | |
from Products.statusmessages.interfaces import IStatusMessage | |
from aeau.contenttypes import contenttypesMessageFactory as _ | |
from aeau.contenttypes.interfaces import ISoci | |
from Acquisition import aq_inner | |
from Acquisition import aq_parent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import datetime | |
import urllib | |
from Acquisition import aq_inner | |
from zope import interface | |
from zope import schema | |
from zope.app.pagetemplate import viewpagetemplatefile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add a subscriber email to Plone object with Subscribers field | |
def add_subscriber(self,plone_object,email): | |
from Products.PythonScripts.standard import html_quote | |
from Products.CMFCore.utils import getToolByName | |
plone_utils = getToolByName(self, 'plone_utils', None) | |
workflowTool = getToolByName(self, "portal_workflow") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request = container.REQUEST | |
idiomactual = context.REQUEST.other['LANGUAGE'] | |
from Products.CMFCore.utils import getToolByName | |
urltool = getToolByName(context, 'portal_url') | |
if context.restrictedTraverse('@@plone').isStructuralFolder(): | |
path_to_translate = '/'.join(context.getPhysicalPath()) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script deletes an entire Django database, calls syncdb, and imports data tables | |
# Drop all tables in cascade | |
psql tablename << EOF | |
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA "public" AUTHORIZATION "postgres"; | |
EOF | |
# Syncdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Definition of the imageevent content type | |
""" | |
from zope.interface import implements | |
from Products.Archetypes import atapi | |
from Products.ATContentTypes.content import base | |
from Products.ATContentTypes.content import schemata | |
# -*- Message Factory Imported Here -*- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Definition of the minisite content type | |
""" | |
from zope.interface import implements | |
from Products.Archetypes import atapi | |
from Products.ATContentTypes.content import folder | |
from Products.ATContentTypes.content import schemata |
OlderNewer