![](https://img-blog.csdnimg.cn/2019091813595558.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
工具
工具
Wonder-King
有好奇心,什么都想学一点。
展开
-
实现优先队列(C#)
internal class FastPriorityQueueNode { /// <summary> /// The Priority to insert this node at. Must be set BEFORE adding a node to the queue /// </summary> public double Priority { get; set; } /.原创 2021-08-16 12:03:44 · 947 阅读 · 0 评论 -
Intellij IDEA自定义类模板和方法模板
依次打开File->Settings->File and Code Templates->Files,可修改class需要创建的等模板依次打开File->Settings->Live Templates新建组,组名随便,然后再在组名下添加template...原创 2020-04-19 15:57:15 · 285 阅读 · 0 评论 -
蓝桥杯 试题 基础练习 十六进制转十进制
问题描述 从键盘输入一个不超过8位的正的十六进制数字符串,将它转换为正的十进制数后输出。 注:十六进制数中的10~15分别用大写的英文字母A、B、C、D、E、F表示。样例输入FFFF样例输出65535思路分析很简单的一道题,首先十六进制转换成二进制,然后二进制转换成十进制。十六进制转换成二进制:可以用数组或者map存储转换进制的规则,然后循环遍历把结果存...原创 2020-03-05 11:26:48 · 368 阅读 · 0 评论 -
Java:十进制转换成二进制(面向对象函数)
方法1:利用“移位”操作实现public void binaryToDecimal(int n){ for(int i = 31;i >= 0; i--) System.out.print(n >>> i & 1);}方法2:调用面向对象函数实现public void function1(int n){ String res...原创 2019-03-09 09:56:49 · 1909 阅读 · 0 评论 -
DFS求组合数C(n,m)
#include<iostream>using namespace std;int a[5];int sum=0;void dfs(int index,int k) { if(index==5) { for(int i=0;i<5;i++) cout<<a[i]<<" "; cout<<endl; sum++...原创 2019-03-16 16:38:30 · 1086 阅读 · 0 评论 -
STL-map(find/count)
使用count,返回的是被查找元素的个数。如果有,返回1;否则,返回0。注意,map中不存在相同元素,所以返回值只能是1或0。使用find,返回的是被查找元素的位置,没有则返回map.end()。...原创 2019-03-16 21:27:21 · 775 阅读 · 0 评论 -
Java:大数加法(BigInteger)
import java.math.BigInteger;import java.util.Scanner;public class BigAdd { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); ...原创 2019-03-23 10:48:43 · 2645 阅读 · 0 评论 -
计算e和pi的近似值公式
原创 2019-04-09 23:10:09 · 2362 阅读 · 0 评论 -
esp(小量),pi的值
epseps缩写自epsilon,表示一个小量,但这个小量又要确保远大于浮点运算结果的不确定量。eps最常见的取值是1e-8左右。引入eps后,我们判断两浮点数a、b相等的方式如下:定义三出口函数如下:int sgn(double a){return a < -eps ? -1 : a < eps ? 0 : 1;}pipi=acos(-1.0)pi...原创 2019-05-02 16:05:57 · 633 阅读 · 0 评论 -
十进制转换成二进制(&移位转换法)
#include<iostream> using namespace std; int len;//表示a转换成二进制输出格式的位数 void cal(int p){ int i; for (i=len-1;i>=0;i--) { if (p&(1<<i)) cout<<1; else cout<<0; ...原创 2019-03-09 09:54:12 · 1895 阅读 · 0 评论 -
对lower_bound的理解
头文件:algorithm lower_bound()返回值是一个迭代器,返回指向比key大的第一个值的位置第一个用法:返回值的下标。#include <algorithm>#include <iostream>using namespace std;int main(){ int a[]={1,2,3,4,5,7,8,9}; printf("%d...原创 2018-12-03 13:34:00 · 2988 阅读 · 0 评论 -
打印数组的排列组合/STL next_permutation函数
在STL中,除了next_permutation外,还有一个函数prev_permutation,两者都是用来计算排列组合的函数。https://blog.csdn.net/qq_42391248/article/details/81382777在C++头文件为#include<algorithm>前者是求出下一个排列组合,而后者是求出上一个排列组合。所谓“下一个”和“上一...原创 2018-08-02 10:10:28 · 332 阅读 · 0 评论 -
HDU1247 Hat’s Words(STL:map)
Hat’s WordsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18645 Accepted Submission(s): 6605Problem DescriptionA hat’s word is a word...原创 2018-08-14 17:46:59 · 176 阅读 · 0 评论 -
STL学习总结
总结STL中vector,set,multiset,map,multimap,deque,stack,list,queue,priority_queue,string的优缺点以及基本的函数用法。STL存在的意义就是把c语言中数据结构的很多很多的代码封装成一个个函数名,方便调用,提高效率。vector(数组)#include<vector>vector<int>...原创 2018-08-15 09:46:29 · 347 阅读 · 0 评论 -
HDU 2054(string的删除运用(字符串数字的去0操作))
A == B ?Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 126255 Accepted Submission(s): 20292Problem DescriptionGive you two numbers A ...原创 2018-09-08 17:13:27 · 227 阅读 · 0 评论 -
51Nod1010 只包含因子2 3 5的数(打表+ lower_bound)
lower_bound这个函数挺好用的。#include<iostream>#include<algorithm>#include<cstring>using namespace std;typedef long long ll;const ll N=1e18+100;ll s[100000];int m=0;void init(){...原创 2018-11-18 17:53:32 · 170 阅读 · 0 评论 -
string 逆序简单方法
#include<iostream>#include<string>using namespace std;int main(){ string a; cin>>a; string b(a.rbegin(),a.rend()); cout<<b<<endl;}原创 2018-12-02 10:05:05 · 3886 阅读 · 3 评论 -
C++位运算符(&、 | 、^)
位运算符位运算符作用于位,并逐位执行操作。&、 | 和 ^ 的真值表如下所示:p q p & q p | q p ^ q 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 假设如果 A = 60,且...原创 2018-12-04 16:02:09 · 51775 阅读 · 3 评论 -
51Nod1278 相离的圆(贪心+lower_bound)
将圆的问题变换成线段的问题,按照左端点排序,如果i的右端点小于j的左端点,那么j之后的圆都和他相离。用lower_bound二分查找找到j,否则会超时。#include<iostream>#include<algorithm>using namespace std;struct node { int l,r,x,R;}a[50005];bool cm...原创 2018-12-02 17:36:44 · 192 阅读 · 0 评论 -
printf(“%*s“,5,““)输出多个空格简单方法
#include <stdio.h>int main(){ printf("%*s%s%*s",5,"","123",3,"" ); return 0;} 输出5个空格,输出123,输出3个空格原创 2018-08-03 17:55:57 · 44597 阅读 · 2 评论