競プロにむけて、高速かつ快適なC++ の開発環境を構築すること。
VSCode, MinGWを使用する。
- VSCode のインストール
- MinGW のインストール
- この際、PATH(環境変数)が適用されるようにする
- 具体的には「システムとプロパティ」の「詳細設定」からいじる * 最新版ではvector やstring が使えない可能性があるのでdowngrade(ver 4.9.3 を使用とのこと:https://code.i-harness.com/en/q/20653e3)
競プロにむけて、高速かつ快適なC++ の開発環境を構築すること。
VSCode, MinGWを使用する。
#include <stdio.h> | |
#include <algorithm> | |
using namespace std; | |
int memo[30][30]; | |
int dp(int i, int j) | |
{ | |
if(memo[i][j] != -1) | |
return memo[i][j]; | |
else if(i == 0 || j == 0) |
#include <cstdio> | |
#include <algorithm> | |
using namespace std; | |
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++) | |
#define N 1000001 | |
#define MAX 1 << 20 | |
int main(){ | |
int n, ai, bi, s[N+1]; |
#include <iostream> | |
#include <vector> | |
#include <queue> | |
#include <algorithm> | |
using namespace std; | |
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++) | |
int main(){ | |
int r, c; cin >> r >> c; |
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
vector<int> a, b, c; | |
int n, inp; | |
long long int ans = 0; |
struct UnionFind | |
{ | |
vector<int> parent; | |
UnionFind(int n) : parent(n) { | |
for(int i = 0; i < n; i++) parent[i] = i; | |
} | |
int root(int x){ | |
return x == parent[x] ? x : (parent[x] = root(parent[x])); | |
} |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int n; cin >> n; cout << n << ":"; | |
int i = 2; | |
while(n != 1) | |
{ | |
if(n % i == 0) |
// extgcd(a, b, &x, &y): a, b(a = qb + r ---(1))が与えられるとき、ax + by = 1 ---(2)となる(x, y)を求める | |
// (2)に(1)を代入したとき、(qb + r)x + by = 1 ⇔ b(qx + y) + rx = 1 | |
// ここで、extgcd(b, a % b, &s, &t)、すなわち、bs + rt = 1が成り立つとき | |
// s = qx + y, t = x ⇔ x = t, y = s - qx = s - a/b * x | |
long long extgcd(long long a, long long b, long long &x, long long &y) { | |
if (b == 0) { | |
x = 1; | |
y = 0; | |
return a; |
int gcd(int a, int b) { | |
return b ? gcd(b, a%b) : a; | |
} | |
int lcm(int a, int b) { | |
return a / gcd(a, b) * b; | |
} | |
int digsum(int n) { | |
int res = 0; |