文章分类 -  OI题目

上一页 1 ··· 7 8 9 10 11 12 下一页
摘要:>>>>加减乘除运算都要时间 >>>>qjs ()*x + ) ............ std::cout 会把输出放到一个叫缓冲区(stream buffer) 里, 直到缓冲区满了才会清空缓冲区并把字串输出到 stdout 之类的输出流, 这也就是为什么关闭了缓冲区可能会出现错误. 那么说到这 阅读全文
posted @ 2023-07-20 18:26 JMXZ
摘要:① 自己指向的节点都可以到达终点。 ② 自己可以到达终点的点。 ③ 普通的点。 那么题目需要的就是: 由①组成的连接了起点和终点的最短路径。 思路: 显然③包含②,②包含①。 那么我们就先通过③求出所有的②,再通过②求出①。 最后再来一遍BFS就能求出最短路径了。 步骤: 1.读入数据,并建立正向和 阅读全文
posted @ 2023-07-20 15:22 JMXZ
摘要:#include <iostream> #include <cstring> #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int ca[N * 2], cb[N * 2],a[N<<1]; /* void g 阅读全文
posted @ 2023-07-19 17:50 JMXZ
摘要:给定的进制n,枚举各个字母代表的数字 ->从右往左搜索 + 便搜遍判断 ->dep==n+1 判断+输出 ->dfs 时 低位的数字较大 >>>dfs 顺序+剪芝 #include<cstdio> #include<cstring> #include<iostream> #include<algor 阅读全文
posted @ 2023-07-19 13:54 JMXZ
摘要://已是回文 #include<bits/stdc++.h> #define int long long using namespace std; inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if 阅读全文
posted @ 2023-07-18 22:15 JMXZ
摘要:画出队列 ->op1,op2操作的都是相同位置的数字 #include<iostream> #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> #include<vector> using namespace 阅读全文
posted @ 2023-07-17 19:39 JMXZ
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int runnian(int x) { if(x%4==0&&x%100!=0)return 1; else 阅读全文
posted @ 2023-07-17 18:31 JMXZ
摘要:https://www.luogu.com.cn/problem/solution/P1099 无根树!!!!! 引理 1:对于一棵所有边权均为正的树,如果其存在多条直径,则树上必存在一点 pp,使得所有直径均经过该点(简单来说,所有直径必交于至少一点)。 证明:用反证法。 d1=max⁡{P(s, 阅读全文
posted @ 2023-07-16 23:39 JMXZ
摘要:#include<iostream> #include<algorithm>//sort必须调用的库 using namespace std; int x1,y1,x2,y2,n;//输入的五个数,为了cmp函数方便使用,开成全局变量 int d[100007];//预处理出来d数组,具体用途请看思 阅读全文
posted @ 2023-07-16 11:26 JMXZ
摘要:取 mm 名志愿者,则面试分数线为排名第 m×150%m×150%(向下取整) /* 6 3 1000 90 3239 88 2390 95 7231 84 1005 95 1001 88 88 5 1005 95 2390 95 1000 90 1001 88 3239 88 */ #includ 阅读全文
posted @ 2023-07-15 22:37 JMXZ
摘要:n是两个不同的质数的乘积 #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 2; i <= n; i++) if (n % i == 0) { cout << n / i; 阅读全文
posted @ 2023-07-15 19:27 JMXZ
摘要:#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<bits/stdc++.h> #define ll long long #define ddd printf(" debug\n"); 阅读全文
posted @ 2023-07-15 19:01 JMXZ
摘要:-> >=2*m 不够准确 -> 看状态是否改变 -> mi[]-minx(c[],minx) + f[]-maxx(c[]-minx,f[pre]) #include<bits/stdc++.h> #define INF 0x3f3f3f3f #define MAXN 100005 using n 阅读全文
posted @ 2023-07-15 18:41 JMXZ
摘要:-》d<=1e9 -> long long or 溢出 //d<=1e9 -> long long or 溢出 /* 4 3 2 5 4 3 2 1 3 3 2 4 4 2 4 -1 2 4 6 1000000000 1000000000 1000000000 1000000000 10000000 阅读全文
posted @ 2023-07-15 09:48 JMXZ
摘要:差分本质-> 区间加减 中 各个元素值的变化 O(n)即可·全部实现操作 #include<cstdio> int f[1010][1010]={0},sum[1010][1010]; int main() { int n,m,x1,y1,x2,y2; scanf("%d%d",&n,&m); fo 阅读全文
posted @ 2023-07-15 09:16 JMXZ
摘要://小心 tmp!=-1 -> 现实意义,不可能-1 ,-》 0 //数据类型 必须一样 //LONG_LONG_MAX /* 10 1 1 645855438 311218536 15797250 227733808 68960766 222753465 32576949 223726014 56 阅读全文
posted @ 2023-07-14 22:05 JMXZ
摘要:#include<cstdio> #include<cstring>//strlen函数 using namespace std; char s[110]; const int prime[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61, 阅读全文
posted @ 2023-07-14 00:39 JMXZ
摘要:最简单的答案+找递推关系 #include<iostream> #include<cstdio> using namespace std; int g[105],f[105],a[105],s[105]; int main() { int n; cin>>n; for(int i=1;i<=n;i+ 阅读全文
posted @ 2023-07-13 23:48 JMXZ
摘要:先想dfs /* #include <iostream> #include <cstdio> using namespace std; int ans=0; void solve(int x,int y,int n) //暴搜 { if(!y) { if(x==1) ++ans; return; } 阅读全文
posted @ 2023-07-13 11:55 JMXZ
摘要:#include<stdio.h> #include<bits/stdc++.h> using namespace std; int main() { int a[2001]={6},b,c[2000]={6,2,5,5,4,5,6,3,7,6},s=0,i,j; scanf("%d",&b); f 阅读全文
posted @ 2023-07-13 08:59 JMXZ

上一页 1 ··· 7 8 9 10 11 12 下一页