Sat, 26 Sep 2020 21:50:22 +0800
parent
1a2b2108bc
commit
1813fbcd38
@ -1 +0,0 @@
|
|||||||
Noisy Shadow 59
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
```cpp
|
|
||||||
invT[1] = 1;
|
|
||||||
for (int i = 2; i < N; i++)
|
|
||||||
invT[i] = (mod - mod / i) * invT[mod % i] % mod;
|
|
||||||
```
|
|
||||||
|
|
||||||
$$
|
|
||||||
p=ax+b \\
|
|
||||||
ax+b \equiv 0 \pmod p\\
|
|
||||||
ab^{-1}+x^{-1} \equiv 0 \pmod p \\
|
|
||||||
x^{-1} \equiv -ab^{-1} \pmod p \\
|
|
||||||
x^{-1} \equiv -\left \lfloor \frac{p}{x} \right \rfloor (p\bmod x)^{-1} \pmod p \\
|
|
||||||
x^{-1} \equiv (p-p/x) (p\bmod x)^{-1} \pmod p \\
|
|
||||||
$$
|
|
||||||
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import java.io.PrintStream;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
class Main {
|
|
||||||
public static void main(String[] argv) {
|
|
||||||
String sp = System.getProperty("line.separator");
|
|
||||||
PrintStream cout = System.out;
|
|
||||||
try (Scanner cin = new Scanner(System.in)) {
|
|
||||||
int T = cin.nextInt();
|
|
||||||
for (int t = 1; t <= T; t++) {
|
|
||||||
BigInteger ba = cin.nextBigInteger(), bb = cin.nextBigInteger();
|
|
||||||
cout.printf("Case %d:%s%s + %s = %s%s", t, sp, ba, bb, ba.add(bb), sp);
|
|
||||||
if (t != T)
|
|
||||||
cout.println();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
from socket import *
|
|
||||||
from struct import *
|
|
||||||
|
|
||||||
while True:
|
|
||||||
st = input(">>> ")
|
|
||||||
s = socket(AF_INET, SOCK_STREAM)
|
|
||||||
s.connect(("127.0.0.1", 8888))
|
|
||||||
s.sendall(pack("!i", len(st.encode())))
|
|
||||||
s.sendall(st.encode())
|
|
||||||
print(s.recv(len(st)).decode())
|
|
||||||
s.close()
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
from socket import *
|
|
||||||
from struct import *
|
|
||||||
from threading import *
|
|
||||||
s = socket(AF_INET, SOCK_STREAM)
|
|
||||||
s.bind(('', 8888))
|
|
||||||
s.listen(100)
|
|
||||||
|
|
||||||
|
|
||||||
def proc(cs):
|
|
||||||
msglen = unpack("!i", cs.recv(4))[0]
|
|
||||||
msg = cs.recv(msglen)
|
|
||||||
cs.sendall(msg.decode().upper().encode())
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
|
||||||
(cs, addr) = s.accept()
|
|
||||||
# Thread(None, proc, args=(cs, )).start()
|
|
||||||
proc(cs)
|
|
||||||
Binary file not shown.
@ -1,25 +0,0 @@
|
|||||||
#include <bits/stdc++.h>
|
|
||||||
using namespace std;
|
|
||||||
uint8_t encode[48] = {
|
|
||||||
0x96, 0x62, 0x53, 0x43, 0x6D, 0xF2, 0x8F, 0xBC,
|
|
||||||
0x16, 0xEE, 0x30, 0x05, 0x78, 0x00, 0x01, 0x52,
|
|
||||||
0xEC, 0x08, 0x5F, 0x93, 0xEA, 0xB5, 0xC0, 0x4D,
|
|
||||||
0x50, 0xF4, 0x53, 0xD8, 0xAF, 0x90, 0x2B, 0x34,
|
|
||||||
0x81, 0x36, 0x2C, 0xAA, 0xBC, 0x0E, 0x25, 0x8B,
|
|
||||||
0xE4, 0x8A, 0xC6, 0xA2, 0x81, 0x9F, 0x75, 0x55};
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
for (int j = 0; j < 6; j++)
|
|
||||||
{
|
|
||||||
uint64_t x = *(uint64_t *)&encode[j << 3];
|
|
||||||
for (int i = 0; i < 64; i++)
|
|
||||||
if (x & 1)
|
|
||||||
x = (x ^ 0xB0004B7679FA26B3uLL) >> 1 | (1ll << 63);
|
|
||||||
else
|
|
||||||
x >>= 1;
|
|
||||||
char *pt = (char *)&x;
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
putchar(pt[i]);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
||||||
#include <bits/stdc++.h>
|
|
||||||
using namespace std;
|
|
||||||
#define CRP(t, x) const t &x
|
|
||||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
|
||||||
#define OPL(t, x) bool OPX(<, t, x) const
|
|
||||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
|
||||||
#define CLR(x) FIL(x, 0)
|
|
||||||
#define NE1(x) FIL(x, -1)
|
|
||||||
#define INF(x) FIL(x, 0x3f)
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#define _DEBUG 0
|
|
||||||
#endif // !_DEBUG
|
|
||||||
#define IFD if (_DEBUG)
|
|
||||||
typedef int64_t ll, i64;
|
|
||||||
typedef uint64_t ull, u64;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
|
||||||
inline char getchar(int)
|
|
||||||
{
|
|
||||||
static char buf[64 << 20], *S = buf, *T = buf;
|
|
||||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + S;
|
|
||||||
return S == T ? EOF : *S++;
|
|
||||||
}
|
|
||||||
template <typename T, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x)
|
|
||||||
{
|
|
||||||
int ch = x = 0, f = 1;
|
|
||||||
while (!isdigit(ch = getchar()))
|
|
||||||
if (ch == '-') f = -1;
|
|
||||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
|
||||||
x *= f;
|
|
||||||
}
|
|
||||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x, Args &... args) { read(x), read(args...); }
|
|
||||||
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
|
|
||||||
ll fpow(ll a, ll b, ll m)
|
|
||||||
{
|
|
||||||
ll r = 1;
|
|
||||||
for (; b; b >>= 1, a = a * a % m)
|
|
||||||
if (b & 1) r = r * a % m;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
constexpr double eps = 1e-8;
|
|
||||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
|
||||||
const int N = 2e6 + 50;
|
|
||||||
char strs[6][N];
|
|
||||||
char *ptrs[6];
|
|
||||||
char harbin[] = "harbin";
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int T, n, k;
|
|
||||||
read(T);
|
|
||||||
while (T--)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 6; i++) scanf("%s", ptrs[i] = strs[i]);
|
|
||||||
bool flag = false;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
bool flag2 = true;
|
|
||||||
for (int i = 0; i < 6 && flag2; i++)
|
|
||||||
flag2 = flag2 && (strchr(ptrs[i], harbin[i]) != NULL);
|
|
||||||
flag = flag || flag2;
|
|
||||||
} while (next_permutation(ptrs, ptrs + 6));
|
|
||||||
puts(flag ? "Yes" : "No");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,124 +0,0 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
||||||
#include <bits/stdc++.h>
|
|
||||||
#include <ext/pb_ds/assoc_container.hpp>
|
|
||||||
#include <ext/pb_ds/hash_policy.hpp>
|
|
||||||
#include <ext/pb_ds/tree_policy.hpp>
|
|
||||||
using namespace std;
|
|
||||||
#define CRP(t, x) const t &x
|
|
||||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
|
||||||
#define OPL(t, x) bool OPX(<, t, x) const
|
|
||||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
|
||||||
#define CLR(x) FIL(x, 0)
|
|
||||||
#define NE1(x) FIL(x, -1)
|
|
||||||
#define INF(x) FIL(x, 0x3f)
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#define _DEBUG 0
|
|
||||||
#endif // !_DEBUG
|
|
||||||
#define IFD if (_DEBUG)
|
|
||||||
typedef int64_t ll, i64;
|
|
||||||
typedef uint64_t ull, u64;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
|
||||||
inline char getchar(int)
|
|
||||||
{
|
|
||||||
static char buf[64 << 20], *S = buf, *T = buf;
|
|
||||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + S;
|
|
||||||
return S == T ? EOF : *S++;
|
|
||||||
}
|
|
||||||
template <typename T, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x)
|
|
||||||
{
|
|
||||||
int ch = x = 0, f = 1;
|
|
||||||
while (!isdigit(ch = getchar()))
|
|
||||||
if (ch == '-') f = -1;
|
|
||||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
|
||||||
x *= f;
|
|
||||||
}
|
|
||||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x, Args &... args) { read(x), read(args...); }
|
|
||||||
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
|
|
||||||
ll fpow(ll a, ll b, ll m)
|
|
||||||
{
|
|
||||||
ll r = 1;
|
|
||||||
for (; b; b >>= 1, a = a * a % m)
|
|
||||||
if (b & 1) r = r * a % m;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
constexpr double eps = 1e-8;
|
|
||||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
|
||||||
const int N = 1e6 + 50;
|
|
||||||
//__gnu_pbds::gp_hash_table<ll, ll> mps[N];
|
|
||||||
//map<ll, ll> mps[N];
|
|
||||||
//__gnu_pbds::tree<ll, ll, less<ll>, __gnu_pbds::ov_tree_tag> mps[N];
|
|
||||||
vector<ll> mps[N];
|
|
||||||
pair<ll, ll> ch[N];
|
|
||||||
ll cnt[N];
|
|
||||||
int ops[N];
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int T, n, op;
|
|
||||||
read(T);
|
|
||||||
while (T--)
|
|
||||||
{
|
|
||||||
read(n);
|
|
||||||
for (int i = 1; i <= n; i++)
|
|
||||||
{
|
|
||||||
auto &&curMap = mps[i];
|
|
||||||
cnt[i] = 0;
|
|
||||||
read(op);
|
|
||||||
ops[i] = op;
|
|
||||||
if (op == 1)
|
|
||||||
{
|
|
||||||
curMap.clear();
|
|
||||||
int k, x;
|
|
||||||
read(k);
|
|
||||||
while (k--) read(x), curMap.push_back(x);
|
|
||||||
}
|
|
||||||
if (op == 2)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
read(x, y);
|
|
||||||
ch[i] = {x, y};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cnt[n] = 1;
|
|
||||||
for (int i = n; i; i--)
|
|
||||||
if (ops[i] == 2) cnt[ch[i].first] += cnt[i], cnt[ch[i].second] += cnt[i];
|
|
||||||
/*map<ll, ll> endMap;
|
|
||||||
for (int i = n; i; i--)
|
|
||||||
if (ops[i] == 1)
|
|
||||||
for (auto &&p : mps[i])
|
|
||||||
endMap[p] += cnt[i];
|
|
||||||
pair<ll, ll> mx = {0, 0};
|
|
||||||
ll len = 0, ans = 0;
|
|
||||||
for (auto &&p : endMap) mx = max(mx, {p.second, p.first}), len += p.second;*/
|
|
||||||
ll mx = 0, mxcnt = 0, len = 0;
|
|
||||||
for (int i = 1; i <= n; i++)
|
|
||||||
if (ops[i] == 1 && cnt[i])
|
|
||||||
for (auto j : mps[i])
|
|
||||||
{
|
|
||||||
if (mx == 0)
|
|
||||||
mx = j, mxcnt += cnt[i];
|
|
||||||
else if (mx == j)
|
|
||||||
mxcnt += cnt[i];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cnt[i] > mxcnt)
|
|
||||||
mx = j, mxcnt = cnt[i] - mxcnt;
|
|
||||||
else
|
|
||||||
mxcnt -= cnt[i];
|
|
||||||
}
|
|
||||||
len += cnt[i];
|
|
||||||
}
|
|
||||||
ll tot = 0;
|
|
||||||
for (int i = 1; i <= n; i++)
|
|
||||||
if (ops[i] == 1 && cnt[i])
|
|
||||||
for (auto j : mps[i])
|
|
||||||
if (j == mx) tot += cnt[i];
|
|
||||||
printf("%lld\n", (tot << 1) <= len ? len : (len - tot) << 1);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
||||||
#include <bits/stdc++.h>
|
|
||||||
using namespace std;
|
|
||||||
#define CRP(t, x) const t &x
|
|
||||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
|
||||||
#define OPL(t, x) bool OPX(<, t, x) const
|
|
||||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
|
||||||
#define CLR(x) FIL(x, 0)
|
|
||||||
#define NE1(x) FIL(x, -1)
|
|
||||||
#define INF(x) FIL(x, 0x3f)
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#define _DEBUG 0
|
|
||||||
#endif // !_DEBUG
|
|
||||||
#define IFD if (_DEBUG)
|
|
||||||
typedef long long ll, i64;
|
|
||||||
|
|
||||||
constexpr double eps = 1e-8;
|
|
||||||
int sgn(double x)
|
|
||||||
{
|
|
||||||
if (x > eps)
|
|
||||||
return 1;
|
|
||||||
if (x < -eps)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
|
||||||
template <typename T, typename = enable_if_arithmetic<T>>
|
|
||||||
struct Point
|
|
||||||
{
|
|
||||||
T x, y;
|
|
||||||
Point OPX(-, Point, rhs) const { return {x - rhs.x, y - rhs.y}; }
|
|
||||||
T OPX(*, Point, rhs) const { return x * rhs.x + y * rhs.y; }
|
|
||||||
T OPX (^, Point, rhs) const { return x * rhs.y - y * rhs.x; }
|
|
||||||
T len2() const { return x * x + y * y; }
|
|
||||||
double len() const { return sqrt(len2()); }
|
|
||||||
};
|
|
||||||
template <typename T>
|
|
||||||
struct Line
|
|
||||||
{
|
|
||||||
Point<T> s, e;
|
|
||||||
T len2() const { return (s - e).len2(); }
|
|
||||||
double len() const { return (s - e).len(); }
|
|
||||||
bool contains(CRP(Point<T>, p)) const { return sgn((s - p) ^ (e - p)) == 0 && sgn((s - p) * (e - p)) <= 0; }
|
|
||||||
};
|
|
||||||
#define Point Point<double>
|
|
||||||
#define Line Line<double>
|
|
||||||
double area(CRP(Point, p1), CRP(Point, p2), CRP(Point, p3))
|
|
||||||
{
|
|
||||||
return abs((p3 - p1) ^ (p2 - p1));
|
|
||||||
}
|
|
||||||
int main2()
|
|
||||||
{
|
|
||||||
Point p[3], e;
|
|
||||||
while (~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y, &e.x, &e.y))
|
|
||||||
{
|
|
||||||
Line ls[3] = {{p[1], p[2]}, {p[0], p[2]}, {p[0], p[1]}};
|
|
||||||
bool flag = true;
|
|
||||||
for (int i = 0; i < 3 && flag; i++)
|
|
||||||
if (ls[i].contains(e))
|
|
||||||
{
|
|
||||||
int l = (i + 2) % 3, r = (i + 1) % 3;
|
|
||||||
int near = (e - p[l]).len2() < (e - p[r]).len2() ? l : r;
|
|
||||||
int other = l + r - near;
|
|
||||||
double len = ls[i].len() * ls[near].len() / 2 / (e - p[other]).len();
|
|
||||||
double fulllen = ls[near].len();
|
|
||||||
Point dif = p[i] - p[other];
|
|
||||||
printf("%.12lf %.12lf\n", p[other].x + dif.x * len / fulllen, p[other].y + dif.y * len / fulllen);
|
|
||||||
if (sgn(area(p[other], e, {p[other].x + dif.x * len / fulllen, p[other].y + dif.y * len / fulllen}) * 2 - area(p[0], p[1], p[2])))
|
|
||||||
return -1;
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
if (flag)
|
|
||||||
puts("-1");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
Point p[3], e;
|
|
||||||
while (~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y, &e.x, &e.y))
|
|
||||||
{
|
|
||||||
Line ls[3] = {{p[1], p[2]}, {p[0], p[2]}, {p[0], p[1]}};
|
|
||||||
bool flag = true;
|
|
||||||
for (int i = 0; i < 3 && flag; i++)
|
|
||||||
if (ls[i].contains(e))
|
|
||||||
{
|
|
||||||
int l = (i + 2) % 3, r = (i + 1) % 3;
|
|
||||||
int near = (e - p[l]).len2() < (e - p[r]).len2() ? l : r;
|
|
||||||
int other = l + r - near;
|
|
||||||
double len = sqrt(ls[i].len2() * ls[near].len2() / 4 / (e - p[other]).len2());
|
|
||||||
double fulllen = ls[near].len();
|
|
||||||
Point dif = p[i] - p[other];
|
|
||||||
printf("%.12lf %.12lf\n", p[other].x + dif.x * len / fulllen, p[other].y + dif.y * len / fulllen);
|
|
||||||
if (sgn(area(p[other], e, {p[other].x + dif.x * len / fulllen, p[other].y + dif.y * len / fulllen}) * 2 - area(p[0], p[1], p[2])))
|
|
||||||
return -1;
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
if (flag)
|
|
||||||
puts("-1");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
||||||
#include <bits/stdc++.h>
|
|
||||||
using namespace std;
|
|
||||||
#define CRP(t, x) const t &x
|
|
||||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
|
||||||
#define OPL(t, x) bool OPX(<, t, x) const
|
|
||||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
|
||||||
#define CLR(x) FIL(x, 0)
|
|
||||||
#define NE1(x) FIL(x, -1)
|
|
||||||
#define INF(x) FIL(x, 0x3f)
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#define _DEBUG 0
|
|
||||||
#endif // !_DEBUG
|
|
||||||
#define IFD if (_DEBUG)
|
|
||||||
typedef int64_t ll, i64;
|
|
||||||
typedef uint64_t ull, u64;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
|
||||||
template <typename T>
|
|
||||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
|
||||||
inline char getchar(int)
|
|
||||||
{
|
|
||||||
static char buf[64 << 20], *S = buf, *T = buf;
|
|
||||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + S;
|
|
||||||
return S == T ? EOF : *S++;
|
|
||||||
}
|
|
||||||
template <typename T, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x)
|
|
||||||
{
|
|
||||||
int ch = x = 0, f = 1;
|
|
||||||
while (!isdigit(ch = getchar()))
|
|
||||||
if (ch == '-') f = -1;
|
|
||||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
|
||||||
x *= f;
|
|
||||||
}
|
|
||||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
|
||||||
inline void read(T &x, Args &... args) { read(x), read(args...); }
|
|
||||||
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
|
|
||||||
ll fpow(ll a, ll b, ll m)
|
|
||||||
{
|
|
||||||
ll r = 1;
|
|
||||||
for (; b; b >>= 1, a = a * a % m)
|
|
||||||
if (b & 1) r = r * a % m;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
constexpr double eps = 1e-8;
|
|
||||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
|
||||||
const int N = 1e4 + 50;
|
|
||||||
int minfac[N], primes[N], pcnt;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
for (ll i = 2; i < N; i++)
|
|
||||||
{
|
|
||||||
if (minfac[i] == 0)
|
|
||||||
minfac[i] = i, primes[pcnt++] = i;
|
|
||||||
for (int j = 0; j < pcnt && primes[j] <= minfac[i] && i * primes[j] < N; j++)
|
|
||||||
minfac[i * primes[j]] = primes[j];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
{
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 2,
|
|
||||||
"metadata": {
|
|
||||||
"language_info": {
|
|
||||||
"name": "python",
|
|
||||||
"codemirror_mode": {
|
|
||||||
"name": "ipython",
|
|
||||||
"version": 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"orig_nbformat": 2,
|
|
||||||
"file_extension": ".py",
|
|
||||||
"mimetype": "text/x-python",
|
|
||||||
"name": "python",
|
|
||||||
"npconvert_exporter": "python",
|
|
||||||
"pygments_lexer": "ipython3",
|
|
||||||
"version": 3
|
|
||||||
},
|
|
||||||
"cells": [
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 11,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import numpy as np"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 14,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": "array([[0., 0., 0.],\n [0., 0., 0.],\n [0., 0., 0.],\n [0., 0., 0.],\n [0., 0., 0.]])"
|
|
||||||
},
|
|
||||||
"execution_count": 14,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"np.zeros((5,3))"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
template <size_t N, size_t M = N>
|
|
||||||
struct Graph
|
|
||||||
{
|
|
||||||
// Basic
|
|
||||||
struct Edge
|
|
||||||
{
|
|
||||||
int nxt, to, len;
|
|
||||||
};
|
|
||||||
int adj[N], ecnt;
|
|
||||||
Edge E[M];
|
|
||||||
void addEdge(int f, int t, int l)
|
|
||||||
{
|
|
||||||
E[++ecnt] = {adj[f], t, l};
|
|
||||||
adj[f] = ecnt;
|
|
||||||
}
|
|
||||||
// Dijkstra
|
|
||||||
|
|
||||||
// ISAP
|
|
||||||
};
|
|
||||||
Loading…
Reference in new issue