摘要: 1 #include 2 #include 3 4 const int N = 256; 5 char buf[N], optr[N]; 6 int opnd[N]; 7 int opndtop,optrtop; 8 9 bool isDigit(char ch)10 {11 return ch >='0' && ch <='9';12 }13 14 int pri(char op)15 {16 if (op=='(') return 0;17 if (op=='+'|| op=='-' 阅读全文
posted @ 2014-03-29 21:45 xzenith 阅读(337) 评论(0) 推荐(0) 编辑
摘要: 1 #include //原来有时候结构体变量不适宜在main函数外申明 2 3 struct date_rec 4 { 5 int day; 6 int month; 7 int year; 8 }; 9 10 struct date_rec current_date;11 12 int days_of_month[][13] = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}13 };14 1... 阅读全文
posted @ 2014-03-29 21:39 xzenith 阅读(942) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 3 int check ( long num ) {//只含0-9这十个数,但是2a=b,3a=c 4 int tmp = 0,i = 9, set = 1; 5 while ( i > 0 ) { 6 i--; 7 tmp = num % 10; 8 if ( ( set & ( 1 = 1) { 9 return 0;10 }11 set |= (1 << tmp );12 num = num / 10;13 }1... 阅读全文
posted @ 2014-03-29 17:59 xzenith 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define N 1000000//差点爆栈long int arr[N];int isPrime(long int n){ int flag=1; long i; if(n%2==0) return 0; for(i=3;i0) ;//printf("%d\t",arr[i]);double dur2=(double)(clock()-b)/CLOCKS_PER_SEC;printf("\n%f\n",dur2);return 0;} 阅读全文
posted @ 2014-03-29 17:42 xzenith 阅读(176) 评论(0) 推荐(0) 编辑
摘要: size_t strlen_d(const char *str) { const char *char_ptr; const ulong *longword_ptr; register ulong longword, himagic, lomagic; for (char_ptr = str; ((ulong)char_ptr & (sizeof(ulong) - 1)) != 0; ++char_ptr) { if (*char_ptr == '\0') return char_ptr -... 阅读全文
posted @ 2014-03-29 17:17 xzenith 阅读(259) 评论(0) 推荐(0) 编辑