![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
goodplus
shhhowyyyue
这个作者很懒,什么都没留下…
展开
-
c++ stl: map
map :映射 ,key、value。(key是唯一的) //头文件 #include <map> //定义 map <string,int> mp; mp["goodplus"] = 99; mp["lx"] = 100; cout<<mp["goodplus"]<<endl;//输出 key 为goodplus的value (99) //遍历输出 map <string,int> :: iterator it;//定义迭代器 it =原创 2022-02-01 21:32:56 · 352 阅读 · 1 评论 -
sort自定义排序
1. 从大到小排序 //引入头文件 #include <algorithm> //定义cmp方法(规则) bool cmp (int a,int b){ return a > b; } //调用sort方法 sort (array,array + len,cmp); 2. 结构体排序 #include <algorithm> struct stu{ string name; int sc; }; bool cmp (stu a,stu b){ //eg:以分数从大到小原创 2022-01-20 21:49:14 · 326 阅读 · 0 评论 -
BigInteger
Java BigInteger 常用方法 //导包 import java.math.BigInteger; //输入 BigInteger number1 = input.nextBigInteger();//Scanner 输入 //字符串构造(可按指定进制输入) String str = "1011100111"; int radix = 2; BigInteger number2 = new BigInteger(str,radix); //基本计算 add(); subtract(); multi原创 2022-01-18 10:32:43 · 191 阅读 · 0 评论 -
java 常用技巧
保留n位小数:System.out.println(String.format("%.7f", area));原创 2022-01-09 22:21:17 · 134 阅读 · 0 评论 -
c++ 常用技巧
1.数字输出补0 int num = 10; //c语言 printf ( "%06d\n" , n);//‘0’代表前面补0,6代表有6位 //c++ #include <iomanip>//头文件 cout<<setw(6)<<setfill('0')<<n;//setw设置宽度,setfill设置补的内容 2.十进制转二进制 //头文件 #include <bitset> //位数 const int num = 5; //输出原创 2022-01-09 22:19:55 · 431 阅读 · 0 评论 -
数据结构基础
1.时间复杂度 评估执行程序所需的时间。可以估算出程序对处理器的使用程度,时间复杂度常用大O符号表述. 一般用O(n),O(n^2)这类表示。 一般算法竞赛,默认的概念就是如果数据n为1,000,000,000,O(n)的算法也可能过不去。 2.空间复杂度 评估执行程序所需的存储空间。可以估算出程序对计算机内存的使用程度。 ...原创 2022-01-08 21:25:59 · 265 阅读 · 0 评论 -
c->c++
1.头文件、命名空间 #include <iostream> using namespace std; 2.输入输出 //输入 cin >> n1 >> n2; //输出 cout<< n1 <<" "<<n2;//和字符串拼接 3.字符串string 使用方法和普通变量相同。 //定义 string str; //输入、输出字符串 cin >>str; cout <<str; //判断原创 2022-01-07 20:21:20 · 503 阅读 · 0 评论