- 博客(71)
- 问答 (1)
- 收藏
- 关注
原创 快速求质因数
#include <bits/stdc++.h>using namespace std;int vis[1000010];const int mod=1e9+7;int main(){ long long n,m,i,j; while(~scanf("%d%d",&n,&m)) { //memset(vis,0,sizeof(v...
2019-04-04 11:12:48
1511
原创 SPFA双端队列
#include <iostream> #include <cstring> #include <queue> using namespace std; const int inf = 0x3fffffff; int d[25005]; int vis[25005]; int num[25005];struct node{ ...
2019-02-11 20:18:01
322
原创 强连通分量
Popular CowsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 37486 Accepted: 15293DescriptionEvery cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 1...
2018-04-20 11:42:02
233
原创 矩阵快速幂
用 fib(n)fib(n) 表示斐波那契数列的第 nn项,现在要求你求 fib(n)fib(n) mod mm。fib(1)=1,fib(2)=1fib(1)=1,fib(2)=1。输入格式输入 22 个整数 n(1 \le n \le 10^{18})n(1≤n≤1018),m(2 \le m \le 100000000)m(2≤m≤100000000)。输出格式输出 fib(n)fib(n)...
2018-03-06 11:57:44
161
原创 扩展欧几里得算法
C. Linetime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputA line on the plane is described by an equation
2017-10-10 22:29:56
286
原创 A Round Peg in a Ground Hole
DescriptionThe DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden peg that fits into pre-cut holes
2017-10-06 17:53:42
339
原创 hdu 4027
Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 19421 Accepted Submission(s): 4589Problem Descriptio
2017-10-03 12:03:15
197
原创 qsort
1.intqsort(a,1000,sizeof(int),comp);其中comp函数应写为:1234int comp(const void*a,const void*b){return *(int*)a-*(int*)b;//return *(int *)b - *(int
2017-10-02 18:18:34
164
原创 判断是否是凸多边形,判断点是否在多边形内,点到直线的距离
B - A Round Peg in a Ground HoleTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThe DIY Furniture company specializes in assem
2017-09-30 16:07:52
617
原创 控制前置0的输出
if(flag>1) { printf("%05d\n",v[i][j]);//不足五位补0 } printf("%05d %d ", v[i][j],f[v[i][j]].x); }
2017-09-25 23:23:01
295
原创 A+B
int c[50]={0};void f(string a,string b){ int i,j,k,t; for(i=b.size()-1,j=a.size()-1,k=0;i>=0;i--,j--,k++) { c[k]+=b[i]-'0'+a[j]-'0'; c[k+1]+=c[k]/10; c[k]%=10; } for(i=j;i>=0;i--) { c
2017-09-25 12:33:08
166
原创 JAVA大数
Ⅰ基本函数:1.valueOf(parament); 将参数转换为制定的类型比如 int a=3;BigInteger b=BigInteger.valueOf(a);则b=3;String s=”12345”;BigInteger c=BigInteger.valueOf(s);则c=12345;2.add(); 大整数相加
2017-09-21 20:37:59
245
原创 KMP算次数
OulipoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15905 Accepted Submission(s): 6318Problem DescriptionThe French author
2017-09-19 22:53:38
636
原创 KMP算法
The Dominator of StringsTime Limit: 3000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2474 Accepted Submission(s): 888Problem DescriptionHe
2017-09-19 20:05:56
245
原创 最小生成树记路径
#include#include #include #include #include using namespace std; const int inf=0xffffff; int a[1005][1005],vis[1005],d[1005],n,m,w,pre[1005]; struct node{ int x,y; }f1[10005];bool cmp(n
2017-09-12 18:45:46
446
原创 SPFA算法
//如果一个点入队次数大于等于节点数则存在负环,return FALSE#include #include #include using namespace std; const int INF = 0x3fffffff; const int MAX = 100; int map[MAX][MAX]; int dis[MAX]; bool vis[MAX];
2017-09-12 11:51:07
184
原创 spfa算法
#include #include #include using namespace std; const int inf = 0x3fffffff; int d[10005]; int vis[10005]; int num[10005];struct cmp { bool operator()(int x,int y)
2017-09-12 11:49:51
197
原创 5C-codeforce Longest Regular Bracket Sequence
C. Longest Regular Bracket Sequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is yet another pro
2017-09-10 14:47:55
206
原创 并查集
int find(int x){ if(f[x]!=x) return f[x]=find(f[x]); return f[x];} void merge(int a,int b) { if(a==b) return; else f[a]=b; }
2017-09-07 19:41:34
191
原创 codeforce 4D
D. Mysterious Presenttime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputPeter decided to wish happy birthday to
2017-09-06 21:11:15
293
原创 codeforce 1C
C. Ancient Berland Circustime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputNowadays all circuses in Berland h
2017-09-05 11:44:27
231
原创 计算几何知识点
公式描述:公式中a,b,c分别为三角形三边长,p为半周长,S为三角形的面积。3.三角形外接圆半径公式公式描述:公式中a,b,c分别为三角形的三边,S为面积。4.正多边形外角和为360度,各个外角相等且等于各边所对应圆心角5.正多变形面积:sin(a)*r*r*n/2; //a为圆心角,r
2017-09-05 11:42:07
333
原创 codeforce 2B
B. The least round waytime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere is a square matrix n × n, consi
2017-09-04 11:50:14
310
原创 迷宫问题
迷宫问题Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 3984Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1
2017-09-03 12:10:17
222
原创 逆元
(a + b) % p = (a%p + b%p) %p (对)(a - b) % p = (a%p - b%p) %p (对)(a * b) % p = (a%p * b%p) %p (对)(a / b) % p = (a%p / b%p) %p (错)a^(p-2) ≡1/a (mod p)什么(,,• ₃ •,
2017-09-03 11:58:53
216
原创 优先队列
1.结构体优先队列struct node{int x;int y;int d;friend bool operator { return a.d>b.d;//小的在前 }}; priority_queueque5; 2.普通优先struct cmp1{ bool operator ()(
2017-08-27 16:45:18
154
原创 FZU-2254 英语考试
#include#include#include#includeusing namespace std;const int inf=0xffffff;int a[1005][1005],vis[1005],d[1005],n,m,w;int prime() { int sum=0,i,j,k,v,ans=0; for(i=1;i
2017-08-24 17:56:36
241
原创 HDU-Coin Change
Coin ChangeTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 20419 Accepted Submission(s): 7179Problem DescriptionSuppose there
2017-08-23 17:45:53
292
原创 HDU-1398 Square Coins
Square CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12878 Accepted Submission(s): 8848Problem DescriptionPeople in Si
2017-08-23 17:42:15
204
原创 地宫取宝 (dfs+dp深搜)
地宫取宝时间限制: 1 Sec 内存限制: 128 MB提交: 4 解决: 3[提交][状态][讨论版]题目描述历届试题 地宫取宝 时间限制:1.0s 内存限制:256.0MB 问题描述 X 国王有一个地宫宝库。是 n x m 个格子的矩阵。每个格子放一件宝贝。每个宝贝贴着价值标签。 地宫的入口在
2017-08-14 23:19:11
374
1
原创 HDU-1078FatMouse and Cheese 记忆化搜索
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10996 Accepted Submission(s): 4668Problem DescriptionFatMo
2017-08-14 17:39:35
174
原创 拦截导弹
算法训练 拦截导弹 时间限制:1.0s 内存限制:256.0MB 问题描述 某国为了防御敌国的导弹袭击,发展出一种导弹 拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的 导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。
2017-08-14 09:36:00
223
原创 Boolean Expressions
Boolean Expressions 时间限制: 1 Sec 内存限制: 128 MB提交: 4 解决: 4[提交][状态][讨论版]题目描述The objective of the program you are going to produce is to evaluate boolean expressions as the one shown next
2017-08-13 11:49:02
734
原创 多校联萌 C-QAQ & 火星情报局
1410: QAQ & 火星情报局 [数学]时间限制: 1 Sec 内存限制: 128 MB提交: 242 解决: 35 统计题目描述QAQ~超级喜欢看火星情报局,每周六都是他一周中最期待的一天,QAQ喜欢和自己一样心愿是“世界和平”的薛之谦,喜欢“一言不合就飙车”的宇哥,喜欢“再扯的提案都能升华为鸡汤”的汪涵局长....当然也喜欢的里面各种各样奇葩有趣的提
2017-08-11 21:26:54
535
原创 多校联萌第三场H-StarFarming
1413: StarFarming [最短路]时间限制: 1 Sec 内存限制: 128 MB提交: 360 解决: 47 统计题目描述星农(StarFarming)公司计划要给员工发路费津贴,发放的规则是这样的:1到n-1代表各个员工家的序号,n代表公司。路费津贴只发给上班的最短路与回家的最短路的总路程最长的人。该市的路建造的有些奇怪,修路只修单行道,即只允许
2017-08-11 21:09:41
341
原创 多校联萌第三场 问题 A: Kick Ass
多校联萌问题 A: Kick Ass时间限制: 1 Sec 内存限制: 128 MB提交: 61 解决: 7题目描述你玩过一个叫做"Kick Ass - Destroy the web"的游戏吗?如果你想玩的话请点击此处当然,你没有玩过也没关系,这个游戏是通过js来加载一个飞船,让你可以通过控制它发射子弹来摧毁网页上的元素,从而获得分数。我们知道HTML是超
2017-08-11 18:32:53
272
原创 HDU-2049考新郎
roblem Description国庆期间,省城HZ刚刚举行了一场盛大的集体婚礼,为了使婚礼进行的丰富一些,司仪临时想出了有一个有意思的节目,叫做"考新郎",具体的操作是这样的:首先,给每位新娘打扮得几乎一模一样,并盖上大大的红盖头随机坐成一排;然后,让各位新郎寻找自己的新娘.每人只准找一个,并且不允许多人找一个.最后,揭开盖头,如果找错了对象就要当众跪搓衣板...
2017-08-11 12:45:15
172
原创 C语言文件常用操作
FILE *fp//定义一个文件类型指针1.fopen函数fopen函数是在当前目录下打开一个文件,其调用的一般形式为:文件指针名=fopen(文件名,使用文件方式);eg:fp=fopen("a1","rb+");“文件指针名”必须是被说明为FILE 类型的指针变量;“文件名”是被打开文件的文件名;“使用文件方式”是指文件的类型和操作要求;“文件名”是字符串常量或
2017-08-08 21:23:21
268
原创 Is Derek lying?-2017 暑期组队训练赛1-HDU-
DerekDerek and AlfiaAlfia are good friends.DerekDerek is Chinese,and AlfiaAlfia is Austrian.This summer holiday,they both participate in the summer camp of Borussia Dortmund.During the summer ca
2017-08-03 22:27:13
335
空空如也
MNIST数据集格式的gzip怎么安装
2021-12-07
TA创建的收藏夹 TA关注的收藏夹
TA关注的人