• C++之算法题模板


    main.cpp:

    #include <iostream>
    #include <vector>
    #include <cstring>
    #include <cstdio>
    #include <algorithm>
    #include <cmath>

    using namespace std;

    std::vector<string> v;
    int len;
    void input(){
    cin >> len;

    }

    void output(){
    cout << len;
    }

    int main(){


    input();

    output();
    return 0;
    }

     gen.cpp:

    #include <iostream>
    #include <vector>
    #include <cstring>
    #include <cstdio>
    #include <algorithm>
    #include <cmath>
    #include <ctime>
    #include <cstdlib>

    using namespace std;

    int N=50000,K = 100000;

    int main(){
    srand(unsigned(time(0)));
    cout << N << " " << K << endl;
    for (int i = 0 ; i < K ; i++){
    cout << rand()%N<<endl;
    }

    }

    Makefile:

    CXX = g++
    ERROR = 2>error.txt
    CXXFLAGS= -g
    TARGET = main.exe
    SOURCES = main.cpp
    IN = < in.txt


    TARGET2 = gen.exe
    SOURCES2 = gen.cpp
    #IN2 = < in.txt
    OUT2 = > in.txt

    all:$(SOURCES)
    $(CXX) $(SOURCES) $(CXXFLAGS) -o $(TARGET) $(ERROR)
    $(TARGET) $(IN) $(OUT)

    gen:$(SOURCES2)
    $(CXX) $(SOURCES2) $(CXXFLAGS) -o $(TARGET2) $(ERROR)
    $(TARGET2) $(IN2) $(OUT2)

    clean:
    del *.exe

  • 相关阅读:
    读操作
    读锁与写锁
    Mvcc
    readView
    版本链
    事务的隔离性
    索引的代价
    keras backend的修改
    caffe 笔记
    菜品识别 SDK调用
  • 原文地址:https://www.cnblogs.com/huangshiyu13/p/5876909.html
Copyright © 2020-2023  润新知