随笔分类 - ACM模板
摘要:1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 #include <string> 5 #include <cstdio> 6 using namespace std; 7 int a[100010]; 8 int
阅读全文
摘要:1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 void max_heapify(int arr[], int start, int end) { 6 // 建立父節點指標和子節點指標 7 int dad
阅读全文
摘要:1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 #include <string> 5 #include <cstdio> 6 using namespace std; 7 int a[100010]; 8 /* 9 void quick_sort(int *a,int left,int right){ 10 i
阅读全文
摘要:#include #include #include #include using namespace std; const int maxn = 1e5 + 10; int n, m; int cnt; struct node{ int L, R;//分别指向左右子树 int sum;//该节点所管辖区间范围内数的个数 node(){ sum = 0; ...
阅读全文
摘要:1 nth_element(a+1 , a + m, a + n+1); 2 nth_element(first , mth, end); 3 区间【first,end)以第m个数为分界线前面都小,后面都大
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define LL long long 6 using namespace std; 7 const int N = 10;//矩阵大小 8 int mod; 9 int k;//矩阵的幂 10 int a[15]; 11 12 struct Matrix 13 { 14 ...
阅读全文
摘要:#include #include #include #include #define LL long long using namespace std; typedef __int64 int64; const int N = 3; __int64 k , MOD = 1e9+7; int arr[50] ; struct Matrix{ int64 mat[N][N]; ...
阅读全文
摘要:Fibonacci again and again 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1,2,3,5,8,13……就是菲波那契数列。 在HDOJ
阅读全文
摘要:The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians
阅读全文
摘要:4009: Doges 题目描述 在一个遥远的地方,住着n只 Doge,它们分别被编号为1到n之间的正整数。 有一天,一个叫 Jrisme 的人来到这里,进行了一些「虐狗」行为。具体的,Jrisme 每次会虐编号连续的一些 Doge。现给出每次虐狗的区间,求最幸运(被虐次数最多)Doge 被虐了多少
阅读全文
摘要:int l; char a[1100]; int tmp[1100]; bool div(int k) { int j=0; int y=0; for(int i=0;i<l;i++) { int sum=a[i]+y*10; int x=sum/k; y=sum%k; ...
阅读全文
摘要:1. 概述 RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j之间的最小/大值。这两个问题是在实际应用中经常遇到的问题,下面介绍一下解决这两种问题的比较高
阅读全文
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int main() 8 { 9 string str; 10 cin >> str; 11 sort(str.begin(), str.end()); 12 cout 2 #include 3 #incl...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int gcd(int a,int b) 6 { 7 return b==0?a:gcd(b,a%b); 8 } 9 int main() 10 { 11 int b,a; 12 while(~scanf("%d%d",&a,&b))...
阅读全文
摘要:/* 2 |埃式筛法| 3 |快速筛选素数| |15-7-26| 4 */ #include <iostream> #include <cstdio> using namespace std; const int SIZE = 1e7; int prime[SIZE]; // 第i个素数 bool
阅读全文

浙公网安备 33010602011771号