原创 杭電hdu 1086 You can Solve a Geometry Problem too 線段相交

http://acm.hdu.edu.cn/showproblem.php?pid=1086 判斷兩條線段是否相交。用叉乘來判斷。 #include <stdio.h> struct Lpoint { double x; doubl

原创 git常用命令小計

創建驗證用的公鑰:ssh-keygen -C 'you email [email protected]' -t rsa 測試公鑰:ssh -v [email protected]# 創建一個版本庫 git init # 每次修改好了後,可以先將

原创 hdu 2717 Catch That Cow bfs

http://acm.hdu.edu.cn/showproblem.php?pid=2717 抓一羣靜止的牛,並且每次移動的方式只有x+1,x-1,2*x,主要要控制數據範圍,不然漫無目的的廣搜會超內存的。 參考代碼: #include

原创 杭電hdu 1248 寒冰王座 完全揹包

http://acm.hdu.edu.cn/showproblem.php?pid=1248 注意與0-1揹包的區別 #include <stdio.h> #include <string.h> int max(int a, int b

原创 在ubuntu 12.04下安裝lamp的簡單方法

sudo tasksel install lamp-server 如果提示tasksel:command not found,則所名tasksel還沒有安裝,需要安裝 安裝語句: sudo apt-get install tasksel

原创 gcc 關於math.h編譯鏈接

gcc file.c -o file 在輸入以上命令時不能成功編譯 需要做以下修改: gcc file.c -o file -lm

原创 linux給文件或目錄添加apache權限

原文出處:http://gbk.chinaunix.net/uid-22322105-id-3062789.html 系統環境:ubuntu11.10/apache2/php5.3.6 在LAMP環境中,測試一個簡單的php文件上傳功能時

原创 root下無法讀寫文件探究

1 在root權限下無法複製~/.gvfs/,也無法刪除~/.gvfs/ 備份/home時出錯 /usr/share/backup# ./backup   cp: 無法獲取"/home/hic/.gvfs" 的文件狀態(stat)

原创 poj 2935 Basic Wall Maze bfs

http://poj.org/problem?id=2935 像這樣的題還是要多練啊,不多說。還有許多需要改進的地方 #include <stdio.h> #include <queue> #include <string> #inclu

原创 網頁時鐘實現代碼html5

<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <style type="text/css"> canvas{position:absolute;top:0px;left:0px;

原创 蔡勒公式

參考維基百科:http://zh.wikipedia.org/wiki/%E8%94%A1%E5%8B%92%E5%85%AC%E5%BC%8F 蔡勒公式由zellar推算出的計算任何一日屬於星期中的哪一天的方法。 公式: w:星期(

原创 杭電hdu 4217 Data Structure? 線段樹

http://acm.hdu.edu.cn/showproblem.php?pid=4217 線段樹,每個節點記錄當前子樹中還有多少個數。 //線段樹 #include <stdio.h> #define MAX 262145 in

原创 杭電hdu 1045 Fire Net dfs

http://acm.hdu.edu.cn/showproblem.php?pid=1045 暴力搜索解決,只是一點不明白,在更新max值時如果我return了竟然錯了,沒有return就ac了。 #include <stdio.h>

原创 杭電hdu 1052 Tian Ji -- The Horse Racing 貪心

http://acm.hdu.edu.cn/showproblem.php?pid=1052 貪心策略 #include <stdio.h> #include <iostream> #include <algorithm> using

原创 ubuntu ibus 圖標在屏幕最上方不能顯示

解決辦法是在命令行輸入一下命令,我的系統是ubuntu 12.04 ibus-daemon -d -x -r 參考文章:http://elephantliu.blog.51cto.com/1107116/589828 點贊