This file contains 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> | |
using namespace std; | |
int N, M; | |
string S, T; | |
int calc(int n, int m) { | |
if (n == N || m == M) |
This file contains 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 "../d.h" | |
using namespace std; | |
int N, M; | |
string S, T; | |
int dp[1001][1001]; |
This file contains 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 "../d.h" | |
using namespace std; | |
int N, M; | |
string S, T; | |
int dp[1001][1001]; |
This file contains 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
def decompress(args) | |
ans = [] | |
args.each do |a| | |
if a.is_a? Array | |
ans.push a.last*a.first | |
else | |
ans.push a | |
end | |
end | |
ans.join("") |
This file contains 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<typename Container, typename Value> | |
Value sum(const Container& c, Value v) | |
{ | |
for (auto x : c) | |
v += x; | |
return v; | |
} |
This file contains 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> | |
using namespace std; | |
class person { | |
private: | |
int age; | |
string name; | |
public: |
This file contains 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
void f() {} // do nothing | |
template<typename T, typename... Tail> | |
void f(T head, Tail... tail) | |
{ | |
g(head); // headに対し何かする | |
f(tail...); // 再度tailに対し実行 | |
} |
This file contains 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
int main() | |
{ | |
cout << "first: "; | |
f(1, 2.2, "hello"); | |
cout << "\nsecond: "; | |
f(0.2, 'c', "yuck!", 0, 1, 2); | |
cout << "\n"; | |
} |
This file contains 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 <stack> | |
using namespace std; | |
class Node { | |
public: | |
int val; | |
Node *left, *right; | |
Node(int v): val(v) {} |
This file contains 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 <fstream> | |
#include <regex> | |
using namespace std; | |
/* | |
Usage: $ g++ -std=c++11 regex_search_sample.cpp && ./a.out | |
// example |
OlderNewer