题目链接:https://codeforces.com/contest/1999/problem/D#include<iostream> #include<string> #include <vector> using namespace std; int main(){ int n; cin>>n; for(;n>0;n--){ string arr1; string arr2; cin>>arr1>>arr2; int
#include<iostream>#include<string.h>#include<string>#include<cmath>#include<algorithm>usingnamespacestd;intmain(){intu; cin>>u;for(inti=1;i<=u;i++) {intle;chararr[110000];intnum[110000];intnum1[110000]; cin>>le;for(inti=le-1;i>=0;i--){ cin>>arr[i]; num[i]=arr[i]-'...
https://codeforces.com/problemset/problem/525/E 每个仙女有三种情况,枚举一下,n对半分,使得复杂度变成o(k*3^(n/2)) 用map统计的时候,每次如果跑for的话会有很多重复的,这样可以直接存下来前缀和 for(auto i:mp){for(intj=1;j<=25;j++){ mp[i.first][j]+=mp[i.first][j-1]; } } 1. 2...
https://codeforces.com/problemset/problem/1304/E 用lca求树上距离 只有3种情况 a->b a->x+x->y+y->b a->y+y->x+x->b 因为距离过长就可以来回走,所以k-len得是偶数 #include <iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<cstring>#defineinf 21474836...
The first line contains an integertt (1≤t≤151≤t≤15) — the number of test cases you need to solve. The first line of each test case contains an integersnn (2≤n≤20002≤n≤2000) — the number of elements in the arrayaa. ...
https://codeforces.com/problemset/problem/525/E 每个仙女有三种情况,枚举一下,n对半分,使得复杂度变成o(k*3^(n/2)) 用map统计的时候,每次如果跑for的话会有很多重复的,这样可以直接存下来前缀和 for(auto i:mp){for(intj=1;j<=25;j++){ ...
https://codeforces.com/problemset/problem/1304/E 用lca求树上距离 只有3种情况 a->b a->x+x->y+y->b a->y+y->x+x->b 因为距离过长就可以来回走,所以k-len得是偶数 #include <iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<cstring>#defineinf 21474836...
[E. Ehab's REAL Number Theory Problem](https://codeforces.com/contest/1325/problem/E) 数论+图论 求最小环 E. Ehab's REAL Number Theory Problem 数论+图论 求最小环 题目大意: 给你一个n大小的数列,数列里的每一个元素满足以下要求: 数据范围是:1<=ai<=1061<=ai<=106 aiai 最多只有7个因数 ...