一個小C庫-創(chuàng)新互聯(lián)

#include#include#define true 1
#define false 0
#define bool _Bool
#define _Bool bool
#define and    &&
#define and_eq &=
#define bitand &
#define bitor  |
#define compl  ~
#define not    !
#define not_eq !=
#define or     ||
#define or_eq  |=
#define xor    ^
#define xor_eq ^=
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define LONG_INT_MAX 9223372036854775807
#define LONG_INT_MIN -9223372036854775807
#define PI_2 3.14
#define PI_4 3.1415
#define PI_7 3.1415926
#define PI_13 3.1415926535897
#define PI_20 3.14159265358979655845
typedef const char* Errtype;
const Errtype InputError = "InputError";
const Errtype OutputError = "OutputError";
const Errtype IndexError = "IndexError";
const Errtype NameError = "NameError";
const Errtype TypeError = "TypeError";
const Errtype SyntaxError = "SyntaxError";
const Errtype IncludeError = "IncludeError";
const Errtype SystemError = "SystemError";
const Errtype UnicodeError = "UnicodeError";
const Errtype ValueError = "ValueError";
const Errtype Exit = "Exit";
struct Fraction{
    int Denominator;
    int Molecule;
};
struct ListNode{
    int Value;
    struct ListNode *Prev;
    struct ListNode *Next;
};

double FractionToDouble(struct Fraction Fract) {
    return (double)Fract.Denominator / (double)Fract.Molecule;
}

FILE* WriteTo(char *Filename){
    return freopen(Filename, "w", stdout);
}

FILE* ReadFrom(char *Filename){
    return freopen(Filename, "r", stdin);
}

void CloseFile(FILE *File){
    fclose(File);
}

void Int_Input(int* Val){
    int s = scanf("%d", Val);
    if(!s){
        printf("Scanned {errtype InputError}, trying to fixed……");
        Int_Input(Val);
    }
}

void String_Input(char* Val){
    int s = scanf("%s", Val);
    if(!s){
        printf("Scanned {errtype InputError}, trying to fixed……");
        String_Input(Val);
    }
}

void Int_Output(int Val){
    int s = printf("%d\n", Val);
    if(!s){
        printf("Scanned {errtype OutputError}, trying to fixed……");
        Int_Output(Val);
    }
}

void String_Output(char *Val){
    int s = printf("%s\n", Val);
    if(!s){
        printf("Scanned {errtype OutputError}, trying to fixed……");
        String_Output(Val);
    }
}

const void* Max(const void* Val1, const void* Val2){
    return Val1 >Val2 ? Val1 : Val2;
}

const void* Min(const void* Val1, const void* Val2){
    return Val1< Val2 ? Val1 : Val2;
}

int Compare(const void* Val1, const void* Val2){
    if(Val1 == Val2){
        return 0;
    }
    return Val1 >Val2 ? 1 : -1;
}

void Reverse(int *List, int From, int To){
    for(int i=From;i<=To;i++){
        int tmp = List[i];
        List[i] = List[To-i];
        List[To-i] = tmp;
    }
}

long long QuickPower(long long Base, long long Index){
    long long result = 1;
    while(Index >0){
        if(Index & 1) result = result * Base % LONG_INT_MAX;
        Index >>= 1;
        Base = Base * Base % LONG_INT_MAX;
    }
    return result;
}

void QuickSort(int *Number, int First, int Last) {
    int i, j, pivot;
    int temp;
    if (FirstNumber[pivot])
                j--;
            if (iStr2[i])c1++;
            if(Str1[i]< Str2[i])c2++;
        }
        if(c1 >c2)return 1;
        if(c1< c2)return -1;
        return 0;
    } else {
        if(l1>l2){
            return 1;
        }
        if(l1Next = This;
        }
        This->Value = i;
        This->Prev = prev;
        This->Next = NULL;
        prev = This;
    }
    return head;
}

struct ListNode* Push_ListNode(struct ListNode *Head, int Value){
    struct ListNode *This = Head;
    while (This->Next != NULL) {
        This = This->Next;
    }
    struct ListNode *Next = (struct ListNode*)malloc(sizeof(struct ListNode));
    Next->Value = Value;
    Next->Next = NULL;
    Next->Prev = This;
    This->Next = Next;
    return Head;
}

struct ListNode* Pop_ListNode(struct ListNode *Head, int Index){
    struct ListNode *This;
    int idx=0;
    while (This->Next != NULL && idx< Index) {
        This = This->Next;
    }
    This->Prev->Next = This->Next;
    This->Next->Prev = This->Prev;
    free(This);
    return Head;
}

int Length_ListNode(struct ListNode *Head){
    struct ListNode *This = Head;
    int count=0;
    while (This->Next != NULL) {
        count++;
        This = This->Next;
    }
    return ++count;
}

int Find(int *List, int Value, int Size){
    int Flag = 0;
    while(List[Flag++]!=Value&&FlagValue == Value){
            count++;
        }
        This = This->Next;
    }
    return count;
}

void List_Output(int *List, int From, int To){
    for(int i=From;i9){
            continue;
        }
        Num += this*This;
        This *= 10;
    }
    return Num;
}

int Find_AscList(int *List, int Size, int Target){
    int left = 0, right = Size - 1, mid = (right + left) / 2;
    while (left< right && List[left] != List[right]) {
        if (List[mid] >= Target) {
            if (right == mid) right--;
            else right = mid;
        } else {
            if (left == mid) left++;
            else left = mid;
        }
        mid = (right + left) / 2;
    }
    if (List[mid] != Target) left = -2;
    return left+1;
}

int Find_DescList(int *List, int Size, int Target){
    Reverse(List, 0, Size+1);
    int answer = Find_AscList(List, Size, Target);
    Reverse(List, 0, Size+1);
    return answer;
}

char* IntegerToString(int Number){
    static char StrNum[1024] = {0};
    int Tail = 0;
    while(Number)StrNum[Tail++] = Number % 10 + '0',Number = Number / 10;
    return StrNum;
}

#define Exit() Throw(Exit)

你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧

你所需要的網(wǎng)站建設(shè)服務(wù),我們均能行業(yè)靠前的水平為你提供.標準是產(chǎn)品質(zhì)量的保證,主要從事網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、企業(yè)網(wǎng)站建設(shè)、手機網(wǎng)站開發(fā)、網(wǎng)頁設(shè)計、成都品牌網(wǎng)站建設(shè)、網(wǎng)頁制作、做網(wǎng)站、建網(wǎng)站。創(chuàng)新互聯(lián)擁有實力堅強的技術(shù)研發(fā)團隊及素養(yǎng)的視覺設(shè)計專才。

當前名稱:一個小C庫-創(chuàng)新互聯(lián)
文章路徑:http://www.muchs.cn/article32/ipssc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、定制網(wǎng)站、外貿(mào)建站微信公眾號域名注冊、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站