题意:给出三角形ABC顶点的坐标,DEF分别是三边的三等分点。求交点所形成的三角形PQR的面积。分析:根据梅涅劳斯定理,我们得到:,解得 另外还有:,解得 所以AR : RP : PD = 3 : 3 : 1同理,BE和CF也被分成这样比例的三段。△ADC = (2/3)△ABC△CDR = (4/...
分类:
其他好文 时间:
2014-10-28 11:47:15
阅读次数:
180
工作无事,搞其它事也不太方便,写点简单代码。本来想写的高大上一些,发现用范型不是一点代码的事,还是算了。#include #include #include typedef struct list{ int val; struct list *next; }Node_def; #defin...
分类:
其他好文 时间:
2014-10-27 19:01:33
阅读次数:
207
在比较大的项目中,如果需要使用全局变量,那么就需要注意一些全局变量声明、使用不当引起的问题了。
本篇文章主要内容有两个:普通全局变量、静态全局变量、全局常量。
1、普通全局变量:假设我们需要在多个不同的编译单元(比如两个.cc文件)中使用全局变量进行传值,如我们有如下三个源码文件:
main.cc:运行入口,有一个main函数,其中会打印出全局变量var的值;
#include "def....
分类:
编程语言 时间:
2014-10-27 17:40:44
阅读次数:
145
递归实现(python):# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self.left = None self...
分类:
其他好文 时间:
2014-10-27 17:21:37
阅读次数:
125
目录1.DLL中导出函数的方式有两种2.查看dll导出函数;3.__declspec(dllexport)和.def文件的区别。1.DLL中导出函数的方式有两种:方式一:在每一个函数声明前添加标识符: __declspec(dllexport)比如:__declspec(dllexport) int...
分类:
其他好文 时间:
2014-10-27 17:14:12
阅读次数:
202
典型的用栈(stack)结构解决问题的例子class Solution: def isPair(self,s1,s2): if (s1=='(' and s2==')')or (s2=='(' and s1==')'): return True ...
分类:
其他好文 时间:
2014-10-27 14:17:47
阅读次数:
186
动态调用action方法,是指用action!method格式的请求来请求后台的逻辑处理
前提条件:在struts.xml或者struts.properties中配置
struts.enable.DynamicMethodInvocation常量为true
,否则动态调用不可用
查看源码:
在org.apache.struts2.dispatcher.mapper.Def..
分类:
其他好文 时间:
2014-10-27 07:00:24
阅读次数:
167
class Animal: def __init__(self, name): # Constructor of the class self.name = name def talk(self): # Abstract method, de...
分类:
编程语言 时间:
2014-10-26 21:07:49
阅读次数:
281
1 . 所在模块,一般在openstack/common/log.py,其实最主要的还是调用了python中的logging模块; 入口函数在def setup(product_name, version='unknown'): """Setup logging.""" if CONF.log_co...
分类:
其他好文 时间:
2014-10-26 21:04:15
阅读次数:
696
第3关 ORZ,又是源代码。开启正则表达式。from urllib import *from urllib.request import *import reres = urlopen('http://www.pythonchallenge.com/pc/def/equality.html')li....
分类:
编程语言 时间:
2014-10-26 19:33:43
阅读次数:
215