原创 非血緣關係進程間mmap通信
創建一個讀文件 mmap_r.c #include<stdio.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<string.h> #in
原创 匿名映射區
不用打開文件來建立映射區 include<stdio.h> #include<fcntl.h> #include<unistd.h> #include<string.h> #include<stdlib.h> #include<s
原创 1134 鋪地毯 2011年NOIP全國聯賽提高組
1134 鋪地毯 2011年NOIP全國聯賽提高組 時間限制: 1 s 空間限制: 128000 KB 題目等級 : 黃金 Gold 題解 查看運行結果 題目描述 Description 爲了準備一個獨特的頒獎典禮,組織者在會
原创 undefined reference to XXXXXX std::basic_string
undefined reference to 'XXXXX(std::basic_string<char, std::char_traits, std::allocator > 原因:在MAKEFILE文件中,未寫該cpp的目標文
原创 共享內存-父子進程通信
#include<stdio.h> #include<fcntl.h> #include<unistd.h> #include<string.h> #include<stdlib.h> #include<sys/mman.h>
原创 Linux系統編程 共享內存 mmap
1.mmap函數介紹 void *mmap(void *addr,size_t length,int prot,int flags,int fd,off_t offset); 返回:成功:返回創建的映射區首地址;失敗:MAP_FA
原创 51 Nod 完美字符串
#include<iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int main() { char s
原创 51 NOD 1008 N的階乘 mod P
//邊乘邊餘,小心溢出 #include<iostream> using namespace std; int main() { long long n,p,sum=1; while(cin>>n>>p) { for(int
原创 hdu 2092 整數解
#include<iostream> using namespace std; int main() { int m,n,i,j; while(cin>>m>>n) { int count=0;
原创 poj 1006 Biorhythms
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 134766 Accepted: 43068 Description Some people
原创 hdu 2031 進制轉換
//這是我寫的,雖然邏輯有點亂,但測試都過了,卻過不了OJ #include<iostream> using namespace std; int a[100]; char b[7]; int n,r; int change_s(in
原创 51Nod 1085 揹包問題
//簡單的01揹包,在此推薦一個博客這個博客http://www.cnblogs.com/sdjl/articles/1274312.html寫的挺好的,容易理解 #include<iostream> #include<algorithm
原创 NYOJ 67 三角形面積
//海倫公式 s=sqrt(p*(p-a)*(p-b)*(p-c)) 其中p爲半周長 #include<iostream> #include<math.h> #include<iomanip> #include<stdlib.h> usi
原创 51NOD 1011 最大公約數GCD
#include<iostream> using namespace std; int main() { int a,b,temp; while(cin>>a>>b){ while(b){//輾轉相除法 temp=b;
原创 51 NOD 1012 最小公倍數LCM
//最小公倍數與最大公倍數的乘積等於這兩個數的乘積 #include<iostream> using namespace std; long long GCD(long long a,long long b); long long LCM