题解列表

筛选

二级C语言-求偶数和 与运算求奇偶

摘要:解题思路:    奇数 & 1 = 1    偶数 & 1 = 0   因为偶数的二进制第一位一定是0,所以可以运用按位与运算(&),判断完直接丢弃,进行黑盒操作参考代码:#include<bits/……

蓝桥杯2019年第十届省赛真题-完全二叉树的权值

摘要:解题思路:观察二叉树每层的序号第一层 2的0次方第二层 2的1次方 到  2的2次方-1等等我们可以记录最大值然后求出每层的和,比较如果sum比较大的话同时更新max和每层开头序号maxi即可注意事项……

C++简单易懂,整除和取余

摘要:解题思路:看代码注释!!!参考代码:#include<bits/stdc++.h> using namespace std; int main(){ long long n; whil……

K-进制数 递归算法,10行C++代码,满分解决

摘要:解题思路:    假设K=10,first0(1)表示当N为1,最高位为0时满足条件的数量,first1(1)表示N为1,最高位不为0(即1~K-1)时满足条件的数量:    1、当N=1时,firs……

适合新手理解的c++

摘要:#include<iostream>using namespace std;int add(int a,int b,int c){ if(a>b) { while(a%b!=0) { c=a%……

algorithm库是真好用

摘要:解题思路:注意事项:参考代码:#include <iostream>#include <algorithm>#include <string>using namespace std;int main(……

适合新手理解的c++

摘要:#include<iostream>using  namespace std;int main(){ int i,j,arr[10]; int start=0; int end=sizeof(arr)……

采用数组反序计算大数

摘要:解题思路:注意事项:参考代码:#include <iostream>#include <string>#include <vector>using namespace std;vector<int> ……

适合新手理解的c++

摘要:参考代码:#include<iostream>using namespace std;int main(){ int arr[10]; int i,j; for(i=0;i<10;i++) { ci……