【原题】
3156: 防御准备
Time Limit: 10 Sec Memory Limit: 512 MB
Submit: 198 Solved: 107
[Submit][Status]
Description
Input
第一行为一个整数N表示战线的总长度。
第二行N个整数,第i个整数表示在位置i放置守卫塔的花费Ai。
Output
...
分类:
其他好文 时间:
2014-05-07 08:22:07
阅读次数:
318
'''
【程序1】
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去
掉不满足条件的排列。
2.程序源代码:
'''
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
...
分类:
编程语言 时间:
2014-05-07 06:02:59
阅读次数:
301
9.2 构造方法
python 中也属于自己的构造函数和析构函数,
class fibs:
def __init__(self):
self.a = 0
self.b = 1
def next(self):
self.a,self.b = self.b,self.a+self.b
return self.a
def __iter__(self):
return sel...
分类:
编程语言 时间:
2014-05-07 05:51:56
阅读次数:
500
Django中内置了Form和Model两个类,有时候页面的表单form类与Model类是一一对应,因此分别定义Form类和Model类会比较麻烦,最简单的方式就是通过Model来生成一个Form类,Django内置的ModelForm就是为此而生的.下面以一个简单的例子来说明它的简单用法.
基本需求
收集用户的日本报名信息
其中JLPT的日语等级分为N1,N2,N3,N4,N5;所以需要一...
分类:
其他好文 时间:
2014-05-07 05:45:28
阅读次数:
423
【Question】
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the p...
分类:
其他好文 时间:
2014-05-07 04:17:18
阅读次数:
259
简单谈谈 Python 中容器的遍历和一下小技巧。
1、遍历单个容器
下面代码遍历一个 List 结构,同样适用于 Tuple、Set 结构类型
>>> x = [1, 2, 3, 'p' , 'y']
>>> for v in x:
... print(x)
...
1
2
3
p
y
遍历字典 Dict 结构也是...
分类:
编程语言 时间:
2014-05-07 04:12:39
阅读次数:
395
Django站点使用django_cas接入SSO(单点登录系统),配置完成后登录,抛出“urlopen error unknown url type: https”异常。寻根朔源发现是python内置的urllib模块不支持https协议。
>>> import urllib
>>> urllib.urlopen('http://www.baidu.com')
>
>>> url...
分类:
编程语言 时间:
2014-05-07 03:43:55
阅读次数:
424
#! /usr/bin/env racket
#lang racket
#|
NAME:
getModelNumber.rkt
This program is used to get model number based on the
input model file name.
USAGE:
./getModelNumber.rkt modelfi...
分类:
其他好文 时间:
2014-05-07 03:17:09
阅读次数:
323
For a given positive integer n, please find the smallest positive integer x that we can find an integer y such that y^2 = n +x^2.
Input
The first line is an integer T, which is the the...
分类:
其他好文 时间:
2014-05-06 19:21:10
阅读次数:
290