上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页
摘要: 为什么第二题就这么难呜呜呜,这不是为难我吗!!! 可以明确的是,又是一个bfs 最少路径,找满足条件的那个层数 1 #include<iostream> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<time.h> 5 #include <s 阅读全文
posted @ 2020-07-12 18:44 安之若醇 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<time.h> 5 #include <queue> 6 using namespace std; 7 int N,ans=0; 8 int ax[4]= 阅读全文
posted @ 2020-07-12 13:54 安之若醇 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1 int read(){ 2 int x=0,f=1; 3 char ch=getchar(); 4 while(ch<'0'||ch>'9'){ 5 if(ch=='-') 6 f=-1; 7 ch=getchar(); 8 } 9 while(ch>='0'&&ch<='9'){ 10 x=( 阅读全文
posted @ 2020-07-12 11:30 安之若醇 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 如何在输入输出上提高一下效率emmmm 1 #include<iostream> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<time.h> 5 using namespace std; 6 7 int main(){ 8 int star 阅读全文
posted @ 2020-07-12 11:18 安之若醇 阅读(766) 评论(0) 推荐(3) 编辑
摘要: 差分,就是求本位与前一个的差. d[i]=a[i]-a[i-1] 一维差分一遍for循环就出来了呀. 有什么用呢? 这种: 1、将区间【1,4】的数值全部加上3 2、将区间【3,5】的数值全部减去5 在某一个数组全部加上或者减去某个东西,就可以用差分数组. 举个例子嗷嗷嗷 1 #include <i 阅读全文
posted @ 2020-07-11 21:45 安之若醇 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 现在看题有种感觉:只闻其名,不知其所云. 比如这个归并. 来吧来吧不多说了啊啊 1 #include <iostream> 2 #include <set> 3 #include <cstring> 4 5 using namespace std; 6 int a[10]={1,2,6,3,4,7, 阅读全文
posted @ 2020-07-09 22:38 安之若醇 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 首先找找规律,两者相加除以二. 按格式读入sscanf 按格式输出printf("02d%",m);前导0 1 #include <iostream> 2 #include <set> 3 #include <cstring> 4 5 using namespace std; 6 //快速幂运算 7 阅读全文
posted @ 2020-07-07 18:05 安之若醇 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 我自己一开始想的差不多,但是好像想得是vector+sort.... 直接用set它不香吗? 还有就是寻找下一个数的时候,没有用upperbound,,, 我想的大概是遍历一遍(就是用for对这个函数进行实现) 但是很慢,,, 那就s.upper_bound 1 #include <iostream 阅读全文
posted @ 2020-07-07 15:58 安之若醇 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 果然是练思维呀!!要是我的话估计就能挨个算一算呜呜呜 分解成 2和5相乘的式子 1 #include <iostream> 2 using namespace std; 3 //快速幂运算 4 5 int main(){ 6 int data[100]={}; 7 int num2=0; 8 int 阅读全文
posted @ 2020-07-06 21:59 安之若醇 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 1 int gcd(long a,long b){//条件a>b 2 if(b==0)return a; 3 return gcd(b,a%b); 4 } 阅读全文
posted @ 2020-07-06 21:39 安之若醇 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页
Live2D服务支持