题不难,但是一开始把读入看错了,调了半天qaq~ Code: #include <bits/stdc++.h> #define N 300 #define setIO(s) freopen(s".in","r",stdin) using namespace std; map<int,int>pp; int n,m,S,T,tot,dis[N][N][30],tmp[N][N],g[N][N]; int main() { int i,j,k,l…
思路:不能走走过来的路,变点交换跑矩阵快速幂. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define y1 skldjfskldjg #define y2 skldfjsklejg using namespace std; ; ; const int inf = 0x…
题目链接: https://projecteuler.net/problem=435 题意: The Fibonacci numbers $ {f_n, n ≥ 0}$ are defined recursively as \(f_n = f_{n-1} + f_{n-2}\) with base cases \(f_0 = 0\) and \(f_1 = 1\). Define the polynomials $ {F_n, n ≥ 0} $ as $F_n(x) =\sum_{i=0}^{n…
!:自环也算一条路径 矩阵快速幂,把矩阵乘法的部分替换成Floyd(只用一个点扩张),这样每"乘"一次,就是经过增加一条边的最短路,用矩阵快速幂优化,然后因为边数是100级别的,所以把点hash一下最多剩下200个 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=205,inf=1e9; int n,m,s,t,g[N],…
题目描述 For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race using the T (2 ≤ T ≤ 100) cow trails throughout the pasture. Each trail connects two different intersections (1 ≤ I1i ≤ 1,000; 1 ≤ I2i ≤ 1,000), each…