- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 X的平方根
题目: 思路:二分查找 #include int sqrt(int x) { long long low=0,mid = 0; long long high = (long long)x; while(low<=high){ mid = (low + high)/2; if(mid*mid == x) return mid;
2017-08-23 19:56:22 293
原创 O_NONBLOCK vs O_NDELAY
O_NONBLOCK vs O_NDELAY in particular things like a read with O_NDELAY can in some situations return a 0 instead of an error and EAGAIN… Since 0 normally means EOF… you have to be aware of this b
2017-08-22 17:01:29 425
原创 奇怪的国家
题目 思路:以字符比较 #include #include #define MAX 50 int main() { char N[MAX]={'\0'},M[MAX],A[MAX]; scanf("%s\n",N); scanf("%s\n",M); for(int i = 0;i< strlen(M); i++) {
2017-08-21 20:47:34 351
原创 function pointer reinterpret_cast
htonl, htons, ntohl, ntohs - convert values between host and network byte order#include <arpa/inet.h> uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32_t ntohl(uint32_t netl
2017-08-21 17:10:05 313
原创 Linux 相关笔记记录1
C++11/C++14 7. Threads with Shared Memory and Mutex - 2017[IPC:Shared Memory]int shmget(key_t key, size_t size, int shmflg);int shmctl(int shmid, int cmd, struct shmid_ds *buf);void *shmat(int shmid, c
2017-08-21 15:49:41 219
原创 泥塑课
泥塑课 [题目](https://nanti.jisuanke.com/t/6) #include #include int main() { int col = 0; int length[50]={0},width[50]={0},higth[50]={0}; char name[90][80]; memset(name,'\0',sizeof(nam
2017-08-17 19:50:10 249
原创 斐波那契数列
斐波那契数列 #include int main(){ int i=0,n=0, ans[100]={0}; scanf("%d",&n); ans[0] = 0; ans[1] = 1; for(i=2;i<=n;i++) { ans[i] = ans[i-1] + ans[i-2]; //printf("%d,%
2017-08-17 19:48:35 192
原创 计蒜课-判断质数
没啥意义,好久没写而已 #include int main() { int i=0,num=1; bool flag= false; scanf("%d",&num); if(num == 2) { printf("YES\n"); }else{ for(i = 2; i <= num/2; ++i){
2017-08-16 12:20:00 227
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人