题解列表
1067: 二级C语言-分段函数(c++题解)
摘要:解题思路:x<0时求绝对值,x>=0并<2时求(x+1)的平方根,x>=2并<4时求(x+2)的5次方,否则求2x+5。注意事项:保留2位小数参考代码:#include <bits/stdc++.h>……
C++ 猴子偷逃问题
摘要: //整体思路:反向推理
#include
using namespace std;
int main()
{
int N;int s = 1;//表示桃子的数量
……
琴海——计负均正——
摘要:解题思路:注意事项:参考代码:#include <stdio.h>
void main()
{
int i=0,a;
int neg=0,pos=0;
float s……
思路很简单,代码很友好(注释),也很短
摘要:解题思路:1.如果是*直接输出,else就考虑相邻元素,这里的相邻元素是核心,可以先考虑同一行和同一列的相邻元素(曼哈顿距离)abs(i - x) + abs(j - y) < 2 // 上下左右的相……
C++ 数据结构 字符串连接
摘要: #include
#include
using namespace std;
int main()
{
string a,b;
string c[3];
f……
数字反转(不用在意什么样例2,其实就是如果是120,反转了之后就是21)
摘要:参考代码:
```c
#include
int main()
{
int n;
scanf("%d",&n);
int a,k=1,b=0;//a用来存n的每一位
if(n……
N以内素数(处理1 2 3 4)(基础)
摘要:解题思路:对1 2 3 4要有特判 否则会漏出循环注意事项: 好好背模板参考代码:#include<iostream>
using namespace std;
int n;
bool pan(……