
刷题集
针对蓝桥杯、leetcode的算法题,但是个人水平有限,算是半个菜鸟,希望能在刷题中不断进步!!!
USTC_daffodil
USTC quasi-postgraduate
展开
-
指针 拨开迷雾
指针 拨开迷雾指针指向关系图通过指针变量修改内存上的数据&通过指针变量获取内存上的数据定义指针变量&使用指针变量指针变量的输出RESULTExchange the values of two numbers by a pointer语句*pa=*pb执行后,a的值会被b覆盖,如果不用temp将a的值保存以后就找不到了RESULTComparison此处不涉及传值和传址调用的区别RESULT指针的地址是随机分配的int 类型的变量 a,pa 是指向它的指针 *&a 与 &*a的原创 2022-04-03 20:34:34 · 1112 阅读 · 0 评论 -
2022/4/3刷题
2022/4/3刷题Pascal's triangle(Turn 45 degrees counterclockwise)RESULTOutput:Three numbers from big to small(Order by ascend)[Pointer/Address method implementation ] Pascal’s triangle(Turn 45 degrees counterclockwise) #include<stdio.h> #define MAX 15 in原创 2022-04-03 18:22:33 · 903 阅读 · 0 评论 -
刷题3/17
刷题3/17nacissistic number nacissistic number #include<stdio.h> int main() { int i,a,b,c; for(i=100;i<1000;i++) { a=i%10; b=i/10%10; c=i/100%10; if(i==(a*a*a+b*b*b+c*c*c)) printf("%d ",i); } return 0; }原创 2022-03-17 14:26:29 · 1141 阅读 · 0 评论 -
刷题3/15
刷题3/15九九乘法表 九九乘法表 #include<stdio.h> void main() { int a,b,res; for(int i=1;i<10;i++) { for(int j=1;j<=i;j++) { res=i*j; printf("%d*%d=%-3d ",i,j,res); } printf("\n");//Newline after each line. } } result ...原创 2022-03-15 17:29:38 · 463 阅读 · 0 评论 -
刷题 3/11
刷题C++万能头文件遇到不知道输入多少组数据的题目->while #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #define ll long long using namespace std; const int fx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2}; const int fy[] = {0, 1, 2, 2,原创 2022-03-11 18:51:56 · 797 阅读 · 0 评论 -
刷题中遇到的函数
Java public String substring(int beginIndex) public String substring(int beginIndex, int endIndex) public char charAt(int index) C++ s.substr(pos, n) 返回一个string字符串,包含s中从pos开始的n个字符的拷贝(pos的默认值是0,n的默认值是s.size() - pos,即不加参数会默认拷贝整个s) 题目代码片段 class Solution {原创 2022-03-09 21:13:45 · 653 阅读 · 0 评论