随笔分类 - 其他
摘要:题目链接 一个字符串,这个字符串的首尾是连在一起的,要求寻找一个位置,以该位置为起点的字符串的字典序在所有的字符串中中最小。
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 typedef long long ll; 8 int n, m; 9 const int maxn = 105; 10 const int MOD = 1e9 + 7; 11 12 struct node{ 13 l...
阅读全文
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 typedef long long LL; 7 8 LL Eular(LL m) 9 { 10 LL res = m; 11 for(LL i=2; i*i 1) 21 res -= res/m; 22 ret...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN = 5e4+5; 9 struct node 10 { 11 int pos, val; 12 }; 13 node a[MAXN], q[MAXN]; 14 15...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 5 const int maxn =100000+5; 6 struct node{ 7 int r, q; 8 }a[maxn]; 9 10 bool cmp(node x, node y){ 11 if(x.r - x.q != y.r - y.q) 12 ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 typedef long long LL; 7 const int MAXN = 1e4+5; 8 const LL INF = 1e15+5; 9 LL a[MAXN], sum[MAXN], ans[MAXN]; 10 11 int main()...
阅读全文
摘要:后来提交一波的时候,最后一组数据超时,于是改用贪心,排序一遍过的:
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 5 typedef long long LL; 6 const int maxn = 2; 7 const LL m = 1000000009; 8 9 struct Matrix 10 { 11 LL v[maxn][maxn]; 12 }; 13 14 //矩阵间...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 const double eps = 1e-8; 7 int cmp(double x) 8 { 9 if (fabs(x) 0) return 1; 11 return -1; 12 } 13 14 st...
阅读全文
摘要:模拟题,用链表来进行模拟
阅读全文
摘要:1 #include 2 #include 3 #include 4 #define MOD 7 5 #define N 2 6 using namespace std; 7 8 struct Matrix 9 { 10 long long v[N][N]; 11 }; 12 13 //矩阵间的乘法%m 14 Matrix matrix_mul(Matrix...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 const int MAXN = 1e4 + 10; 10 const int MAXA = 11; 11 12 struct num 13 { 14 char...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 #define INF 0xffffff 7 const int maxn = 100000 + 5; 8 typedef long long LL; 9 int a[maxn]; 10 LL sum[maxn]; 11 12 int main(){...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 6 #define INF 0xfffffff 7 using namespace std; 8 const int maxn = 26; 9 int a[maxn]; 10 11 bool is_ok(){ 12 for (int i = 0; i > s; 23 ...
阅读全文
摘要:1 #include 2 #include 3 4 using namespace std; 5 typedef long long LL; 6 7 //给予二整数 a 与 b, 必存在有整数 x 与 y 使得ax + by = gcd(a,b) 8 LL extgcd(LL a, LL b, LL &x, LL &y){ 9 LL d = a; 10 ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1000001; 7 8 int a[maxn]; 9 10 int main() 11 { 12 int n; 13 while (~scanf("%d", &n)){ 14 me...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 const int maxn = 1e5 + 100; 8 char str[maxn]; 9 int a[maxn]; 10 11 int main() 12 { 13 int n, i, j, ans, t, tt, tt...
阅读全文
摘要:1 #include 2 #include 3 4 using namespace std; 5 const int maxn = 50000 + 5; 6 struct node{ 7 long long x; 8 int id; 9 }a[maxn]; 10 11 bool cmp(node xx, node yy){ 12 if (xx.x...
阅读全文