This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
#define MAX(a, b) a > b ? a : b; | |
typedef struct | |
{ | |
int *digits; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sstream> | |
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string st("192.255.a.0"); | |
std::istringstream iss(st); | |
std::string st1; | |
int count = std::count(st.begin(), st.end(), '.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <string> | |
#include <iostream> | |
#include <algorithm> | |
void z_function (const std::string & s, std::vector<int> & z) | |
{ | |
size_t length = s.length(); | |
z.clear(); | |
z.resize(length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <string> | |
void prefix_function (const std::string & s, std::vector<int> & pi) | |
{ | |
size_t length = s.length(); | |
pi.resize(length); | |
for (size_t i = 1; i < length; ++i) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <unordered_map> | |
#include <map> | |
#include <utility> | |
#include <queue> | |
#include <stdio.h> | |
#include <cstdlib> | |
char st[900001]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <cstdio> | |
#include <cstdarg> | |
template<typename T> | |
class result | |
{ | |
private: | |
T value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class base_iterator | |
{ | |
private: | |
int * pointer; | |
protected: | |
virtual void advance(int *& pointer) = 0; | |
public: | |
base_iterator & operator++() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class ADVANCE_STRATEGY> | |
class base_iterator : ADVANCE_STRATEGY | |
{ | |
private: | |
int * pointer; | |
public: | |
base_iterator & operator++() | |
{ | |
advance(pointer); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boost::shared_mutex _access; | |
void reader() | |
{ | |
boost::shared_lock< boost::shared_mutex > lock(_access); | |
// do work here, without anyone having exclusive access | |
} | |
void conditional_writer() | |
{ | |
boost::upgrade_lock< boost::shared_mutex > lock(_access); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <exception> | |
#include <codecvt> | |
#include <streambuf> | |
#include <string> | |
#include <cerrno> | |
#include <sstream> | |
using namespace std; |
OlderNewer