使用二分查找算法解猜价模拟 摘要:解题思路:二分查找法:确定被查找的范围,确定其左下标和右下标,然后再确定中间元素的下标中间元素比要找的小,要找的在中间元素的右边。中间元素比较要找的大,要找的中间元素的左边。数组在传参的时候仅仅传过去…… 题解列表 2023年11月05日 0 点赞 0 评论 340 浏览 评分:9.9
计算邮资(一般方法) 摘要:解题思路:主要利用一个向上取整函数m=ceil(),求不小于m的最大整数。补充:floor()为向下取整函数。注意事项:scanf,整型和字符型之间要有空格,要加一个头文件#include <math…… 题解列表 2023年11月05日 0 点赞 0 评论 576 浏览 评分:9.9
宏定义之闰年判断(常规解) 摘要:解题思路:闰年,就是能够被4整除且不能被100整除的年份(普通闰年),或者是能被400整除的年份(世纪闰年)注意事项:宏定义,是一个预处理命令,用来定义常量和函数,有以下三种。#define 标识符 …… 题解列表 2023年11月05日 1 点赞 0 评论 1035 浏览 评分:9.9
图像旋转(挺绕的,我是再整了一个数组为旋转了90度的数组) 摘要:解题思路:旋转90度得到的新数组也就是原来数组的每一列,变为新数组的每一行注意事项:参考代码:#include<stdio.h> int main() { int n,m; scanf("…… 题解列表 2023年11月05日 0 点赞 0 评论 252 浏览 评分:0.0
2787有一门课不及格的学生题解(c++) 摘要:#include using namespace std; int main(){ int a; int b; cin>>a>>b; if (a…… 题解列表 2023年11月05日 0 点赞 0 评论 313 浏览 评分:8.0
2892: 最好的草 摘要:对找到的草进行扩展参考代码:#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int m…… 题解列表 2023年11月05日 0 点赞 0 评论 534 浏览 评分:9.9
1783: 星期判断机题解(c++) 摘要:#include using namespace std; int main(){ int a; cin>>a; if (a == 0) { cout…… 题解列表 2023年11月05日 0 点赞 0 评论 317 浏览 评分:6.0
题解 1151: C语言训练-计算一个整数N的阶乘 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int main(){ int N,a=1; cin>>N; for(int i=1…… 题解列表 2023年11月05日 0 点赞 0 评论 381 浏览 评分:0.0
c++ STL解法,用上vector容器,sort函数 摘要:#include<iostream> #include<vector> #include<algorithm> using namespace std; bool cmp(int a,int …… 题解列表 2023年11月05日 0 点赞 0 评论 261 浏览 评分:0.0
2804: 与指定数字相同的数的个数 摘要:``` #include using namespace std; int main(){ int x,k,n,x1=0; cin>>k>>x; for(int i=1; i>n; …… 题解列表 2023年11月05日 0 点赞 0 评论 274 浏览 评分:0.0