V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Esay
V2EX  ›  自言自语

又不会发 Gist 了

  •  
  •   Esay · 2015-01-04 14:35:51 +08:00 · 674 次点击
    这是一个创建于 3698 天前的主题,其中的信息可能已经有所发展或是发生改变。
    #include <iostream>
    #include <fstream>
    #include <bitset>
    #include <queue>
    #include <vector>
    #include <functional>
    using namespace std;
    bitset<4294967296> bits;
    priority_queue<int, vector<int>, greater<int> > res;
    int main(int argc, char *argv[]) {
    ifstream inf("file1");
    long long index;
    while(inf>>index) {
    index += 2147483648;
    bits.set(index);
    }
    ifstream inf2("file2");
    while(inf2>>index) {
    index += 2147483648;
    if(bits[index]) {
    res.push(index-2147483648);
    }
    }
    while(!res.empty()) {
    cout<<res.top()<<endl;
    res.pop();
    }
    return 0;
    }
    view raw same.cpp hosted with ❤ by GitHub
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5828 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:34 · PVG 10:34 · LAX 18:34 · JFK 21:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.