提交 62a6d2c6 编写于 作者: 每日一练社区's avatar 每日一练社区

update dailycode pipline

上级 01430978
{
"node_id": "dailycode-659113f1c9534393bc7af45277e231c3",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "23fbcc5cba90414cbd9c7d9fd09d828b",
"keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解"
}
\ No newline at end of file
# 存了多少零钱
<p style="margin-left:.0001pt; margin-right:0">小林和小树兄弟俩相约存零钱。眼看到年底了&#xff0c;兄弟俩决定算算一共存了多少钱&#xff0c;请帮他们算出来。</p><p style="margin-left:.0001pt; margin-right:0">输入&#xff1a;</p><p style="margin-left:.0001pt; margin-right:0">两行&#xff0c;第一行三个整数分别对应元、角、分&#xff0c;表示小林存的零钱数&#xff1b;</p><p style="margin-left:.0001pt; margin-right:0">第二行三个整数分别对应元、角、分&#xff0c;表示小树存的零钱数。</p><p style="margin-left:.0001pt; margin-right:0">输出&#xff1a;</p><p style="margin-left:.0001pt; margin-right:0">两人存的钱数&#xff08;单位&#xff1a;&#xff0c;保留2位小数)</p><p style="margin-left:.0001pt; margin-right:0">样例输入&#xff1a;</p><p style="margin-left:.0001pt; margin-right:0">30 5 5</p><p style="margin-left:.0001pt; margin-right:0">45 7 4</p><p style="margin-left:.0001pt; margin-right:0">样例输出&#xff1a;</p><p style="margin-left:.0001pt; margin-right:0">76.29</p>
## template
```cpp
#include <stdio.h>
int main()
{
int y1,j1,f1,y2,j2,f2;
int y,j,f;
int shiftj = 0;
int shifty = 0;
float ss ;
scanf("%d %d %d",&y1,&j1,&f1);
scanf("%d %d %d",&y2,&j2,&f2);
f = f1 + f2;
if(f>=10)
{
f = f-10;
shiftj = 1;
}
j = j1 + j2 + shiftj;
if(j >= 10)
{
j = j - 10;
shifty = 1;
}
y = y1 + y2 + shifty;
ss = y + j/10.0 + f/100.0;
printf("%.2f\n",ss);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-8473ba565595414287199b6bf6e99650",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "48a2299546e240d8bb63d91b011b172a",
"keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量"
}
\ No newline at end of file
# 工龄问题求解,工龄 人数
<p>给定公司N名员工的工龄&#xff0c;要求按工龄增序输出每个工龄段有多少员工。输入首先给出正整数N&#xff0c;即员工总人数&#xff1b;
随后给出N个整数&#xff0c;即每个员工的工龄&#xff0c;范围在[0, 99]。其中&#xff0c;0-9为第1个工龄段&#xff0c;10-19为第2个工龄段&#xff0c;&#xff0c;90-99为第10个工龄段。按工龄的递增顺序输出每个工龄的员工个数&#xff0c;格式为&#xff1a;“工龄:人数”。每项占一行。如果人数为0则不输出该项。</p>
## template
```cpp
#include <stdio.h>
int main()
{
int i,n,a[11]= {0},x;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&x);
if(x<=9)
a[1]++;
else if(x>9&&x<=19)
a[2]++;
else if(x>19&&x<=29)
a[3]++;
else if(x>29&&x<=39)
a[4]++;
else if(x>39&&x<=49)
a[5]++;
else if(x>49&&x<=59)
a[6]++;
else if(x>59&&x<=69)
a[7]++;
else if(x>69&&x<=79)
a[8]++;
else if(x>79&&x<=89)
a[9]++;
else
a[10]++;
}
for(i=1;i<=10;i++){
if(a[i]>0){
printf("%d-%d:%d\n",i*10-10,i*10-1,a[i]);
}
}
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-9b98838d461840a68d81fa582efcc5d0",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "b76b09bcf1264b0191d968f66d7f8e64",
"keywords": "算法初阶,基础知识,特征序列,概率分析和随机算法,概率分析和指示器随机变量的进一步使用"
}
\ No newline at end of file
# 求分数数列的前N项和
有一分数序列:2/1,-3/2,5/3,-8/5,13/8,-21/13,…, 由用户输入项目数N,求这个数列的前N 项之和
## template
```cpp
#include<stdlib.h>
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int i;
double a1 = 2, b1 = 1;
double a2 = 3, b2 = 2;
double sum = a1/b1 - a2/b2;
if(n==1) printf("%f\n",a1/b1);
else if (n==2) printf("%f\n",sum);
else{
for(i = 0;i<n-2;i++){
double exp = a2 / b2;
if(i%2==0) exp *= -1;
sum += exp;
double a = a1 + a2;
double b = b1 + b2;
a1 = a2;b1 = b2;
a2 = a; b2 = b;
}
printf("%f\n",sum);
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-b0c9775cbc6d4ef28d69b8fdab3f0378",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "42ff182f3527447da5feb913a15ca2d0",
"keywords": "算法,图形输出"
}
\ No newline at end of file
# 输入一个正整数n(代表图形的行数),输出如样例形式的图形。
输入:7
输出:
D D
CD DC
BCD DCB
ABCDDCBA
BCD DCB
CD DC
D D
## template
```cpp
#include<stdio.h>
#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n;
cin>>n;
vector<string> a(n,""),b(n,"");
int m=(n+1)/2;
int p=0;
for(int i=m-1;i>=0;i--){
for(int j=0;j<=i;j++)
a[i].push_back('A'+j+p);
b[i]=a[i];
reverse(b[i].begin(),b[i].end());
for(int j=i+1;j<m;j++){
a[i]+=" ";
b[i]+=" ";
}
p++;
}
p=0;
for(int i=n-1;i>=m;i--){
a[i]=a[p];
b[i]=b[p++];
}
for(int i=0;i<n;i++)
cout<<a[i]<<b[i]<<endl;
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-d0584ef2dfdc41d799d69522c0b52e3f",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "f6bbde31ecf143c18180309f822dd46f",
"keywords": "算法中阶,动态规划,最长公共子序列,高级设计和分析技术"
}
\ No newline at end of file
# 数组元素循环右移问题
题目:一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?
输入格式:
每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(≥0);第2行输入N个整数,之间用空格分隔。
输出格式:
在一行中输出循环右移M位以后的整数序列,之间用空格分隔,序列结尾不能有多余空格。
输入样例:
6 2
1 2 3 4 5 6
输出样例:
5 6 1 2 3 4
## template
```cpp
#include<stdio.h>
int main()
{
int n,m,a[1000];
scanf("%d %d",&n,&m);
m = m % n;
int count=m;
while(m<n)
{
scanf("%d",&a[m]);
m++;
}
for(int i=0;i<count;i++)
scanf("%d",&a[i]);
int first=1;
for(int i=0;i<n;i++)
{
if(!first)printf(" ");
printf("%d",a[i]);
first=0;
}
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-b7369ca7ec414d56af56ba02b0a69c75",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "81b094ea77f744eeb7b681e1d5fae331",
"keywords": "算法初阶,基础知识,分治策略,证明主定理,对b的幂证明主定理"
}
\ No newline at end of file
# 编写程序:判断素数的个数
<p>在一个数组A中存放100个数据&#xff0c;用子函数判断该数组中哪些是素数&#xff0c;并统计该素数的个数&#xff0c;在主函数中输出该素数的个数</p>
## template
```cpp
#include <stdio.h>
#include <stdlib.h>
int isPrime(int n)
{
int i = 2;
if(n<2) return 0;
for (i=2;i<n;i++)
{
if(n%i == 0)
return 0;
}
return 1;
}
int CountPrime(int a[],int size)
{
int i =0,count = 0;
for (i = 0;i<size;i++)
{
if(isPrime(a[i]))
{
printf("%d ",a[i]);
count++;
if(count%10 == 0)
printf("\n");
}
}
printf("\n");
return count;
}
int main()
{
int a[100],i,count = 0;
for(i = 0;i<100;i++)
a[i] = rand()%1000;
printf("素数的个数:%d\n",CountPrime(a,100));
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-09803f06a26b40b1acc71cb81904ca38",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "bcc8e5e7bdee4384acf884f7a2917198",
"keywords": "数学运算"
}
\ No newline at end of file
# 商品优惠计算器
<p>商品优惠计算器
使用if语句编程实现输入购货金额&#xff0c;输出实际付款金额。购货折扣率如下&#xff1a;
购货金额≤500元 不打折
500元&lt;购货金额≤1000元 9折
1000元&lt;购货金额 8折</p>
## template
```cpp
#include <stdio.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main()
{
float money=0.0;
float pay=0.0;
bool run = true;
while(run)
{
printf("\n请输入购货金额:\n");
scanf("%f", &money);
if(money >1000)
{
pay=money*0.8;
printf("打八折,应付金额:%.2f\n",pay);
}
else if((money >500)&&(money <=1000))
{
pay=money*0.9;
printf("打九折,应付金额:%.2f\n",pay);
}
else if(money <=500)
{
printf("不打折,应付金额:%.2f\n",money);
}
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-b452064dae7f49daa4287d2d1d8be8c8",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "64397c58dd764b28a69ae59cb1741686",
"keywords": "算法高阶,数论算法,元素的幂,算法问题选编"
}
\ No newline at end of file
# 移动数组中的元素
题目描述
将一维数组中的元素循环左移 k 个位置
输入描述
第 1 行是一维数组元素的个数 n (数组大小)
第 2 行是一个整数 k , 表示移动的位置
下面 n 行为数组的元素个数
输出描述
输出 n 行,表示移动后的数字
## template
```cpp
#include<stdio.h>
#define N 10000
int main()
{
int k,a[N],b[N],n,t,w,i;
scanf("%d",&n);
scanf("%d",&k);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for (i = 0; i < k % n; i++)
b[i] = a[i];
for (i = 0; i < n; i++)
{
if (i < n - k % n)
a[i] = a[i + k % n];
else
a[i] = b[i - n + k % n];
}
for(i=0;i<n;i++)
printf("%d\n",a[i]);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-fe83f29c5d744a0d92ed241ffa819776",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "70771cfc0f8446f89d858067d0f83ebd",
"keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量,期望为线性时间的选择算法"
}
\ No newline at end of file
# 个位数是6,且能被3整除的五位数共有多少个?
<p>要求:
1、必须包含循环结构、顺序结构、选择分支结构。
2、必须包含数组
3、必须包含一个以上函数
4、可以包含方针</p>
## template
```cpp
#include <iostream>
using namespace std;
void search1(){
int i,t=0;
for(i=10000;i<=99999;i++){
if(i%3==0&&i%10==6)
t++;
}
cout<<t;
}
int main()
{
search1();
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-f755126bfaad4e12b83f1f14df1297ba",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "0464585875d748ef8c78db07d22ba5da",
"keywords": "桶排序,算法初阶,线性时间排序,排序和顺序统计量"
}
\ No newline at end of file
# 一个整数的序列,要求对其重新排序
<p>一个整数的序列&#xff0c;要求对其重新排序。排序要求:
1.奇数在前&#xff0c;偶数在后&#xff1b;
2.奇数按从大到小排序&#xff1b;
3.偶数按从小到大排序。<br />
输入一行&#xff0c;包含整数个数n&#xff0c; n个整数值&#xff0c;彼此以一个空格分开。
按照要求排序后输出一行&#xff0c;包含排序后的n 个整数。
 </p>
## template
```cpp
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(int a, int b){
    int x = a % 2;
    int y = b % 2;
    if(x == y)
        if(x == 0)
            return a < b;
        else
            return a > b;
    else
        return x > y;
}
int main()
{
    int n, i;
    cin >> n;
    int a[n];
    for(i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a+n, cmp);
    for(i = 0; i < n; i++)
        cout << a[i] << " ";
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-4d4a1d972a6e474194d4d8408400a210",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "369886bd0cc34c37add5a3bd8c372056",
"keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量"
}
\ No newline at end of file
# 给出一个由O和X组成的串,长度为1~80,统计得分
给出一个由O和X组成的串,长度为1~80,统计得分,每个O的得分为目前连续出现的O的个数,X的得分为0,例如OOXXO的得分为1+2+0+0+1.
## template
```cpp
#include"stdlib.h"
#include"string.h"
#include"stdio.h"
int main()
{
char s[85];
int score = 0,x;
scanf("%s",&s);
for (int i = 0;s[i];i++)
{
if (s[i] == 'X')
score += 0;
if (s[i] == 'O')
{
int temp = 1;
if (i == 0)score += 1;
else
{
x=i;
while (x > 0)
{
if (s[x - 1] == 'O')temp++;
else break;
x--;
}
score += temp;
}
}
}
printf("%d\n", score);
system("pause");
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-a905ce2f8a314d7b9f001b91ec96e70c",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "586adba1cd25495db0b4047bcdebe834",
"keywords": "算法初阶,基础知识,算法基础,设计算法,分析分治算法"
}
\ No newline at end of file
# 一个班有10个同学,通过键盘输入成绩,并打印输出,每行输出5个同学的成绩。并求出平均成绩,最高分、最低分并输出。
<p>一个班有10个同学&#xff0c;通过键盘输入成绩&#xff0c;
并打印输出&#xff0c;每行输出5个同学的成绩。并求出平均成绩&#xff0c;最高分、最低分并输出。算法分析&#xff1a;
(1)定义一个数组用来存放10个成绩数据。
(2)用循环结构实现成绩输入&#xff1b;
(3)用循环结构实现成绩输出,并控制换行&#xff1b;
(4)使用循环结构求平均成绩、最高分、最低分并输出。</p>
## template
```cpp
#include <stdio.h>
int main(){
int x,i,max=0,min=0;
double sum=0,ave=0;
int a[10];
for(i=0;i<10;i++){
scanf("%d",&a[i]);
if(i==0)
min = a[i];
sum+=a[i];
if(max<a[i])
max=a[i];
if(min>a[i])
min=a[i];
}
ave=sum/10;
for(i=0;i<5;i++)
printf("%d ",a[i]);
printf("\n");
for(i=5;i<10;i++)
printf("%d ",a[i]);
printf("平均成绩%f,最高分%d,最低分%d ",ave,max,min);
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-5540e08dda46435695d0a4b2859d8c4a",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "ea9715e1ed5c4f79bf050f6747f60a60",
"keywords": "算法高阶,计算几何学,算法问题选编,确定任意一对线段是否相交"
}
\ No newline at end of file
# 实现五则运算
<pre><p>设计一个可以完成任意五则运算&#xff08;加法/减法/乘法/除法/取余&#xff09;的程序。除法按照计算机中<strong>整型相除</strong>来计算。
输入格式
多行输入&#xff0c;每输入一行数据对应输出一行。
每行输入格式为 a # b&#xff0c;其中 &#xff03;∈{&#43;,−,∗,/,%}
a,b均为自然数
输出格式
每行输出对应的计算结果&#xff1b;
当运算为除法/取余的时候&#xff0c;如果除数为 0 &#xff0c;输出 <code>WA</code> 。</pre>
<p>输入样例</p>
<pre>
<code>2&#43;2
4*5
6/7
4%3
4%0</code></pre>
<p>输出样例</p>
<pre>
<code>4
20
0
1
WA</code></pre>
## template
```cpp
#include<stdio.h>
int main()
{
int a;
int b;
char operation;
int num;
while (scanf("%d", &a) != EOF)
{
scanf("%c", &operation);
scanf("%d", &b);
if (operation == '+')
{
num = a + b;
printf("%d\n", num);
}
else if (operation == '-') {
num = a - b;
printf("%d\n", num);
}
else if (operation == '*') {
num = a * b;
printf("%d\n", num);
}
else if (operation == '/' && b != 0) {
num = a / b;
printf("%d\n", num);
}
else {
printf("%s\n", "WA");
}
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-ab2faaa788af4af68e393c3ef352f3b8",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "b808c6775b7447a8956e6ee05fd004c2",
"keywords": "B树,算法高阶,高级数据结构,B树上的基本操作"
}
\ No newline at end of file
# 输入两个小写英语字母后, 输出两个字母的差
两个小写字母的差用整数输出。
但是,输入小写以外的文字就结束程序。
比较两个字母的部分用diff这个名字的函数书写。执行结果
请输入两个小写:a b
字母a和字母b的区别是1。
请输入两个小写:f b
字母f和字母b的差异是4。
请输入两个小写:0 a
退出程序。
## template
```cpp
#include <iostream>
using namespace std;
int diff(char ch1, char ch2)
{
if (ch1 > ch2) return ch1 - ch2; else return ch2 - ch1;
}
int main()
{
char a, b;
while (1)
{
cout << "请输入两个小写:";
cin >> a >> b;
if (a > 'z' || a < 'a' || b > 'z' || b < 'a') break;
cout << "文字" << a << "和文字" << b << "的差异是" << diff(a, b) << "。\n";
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-61b527860365443e99313e78c5f585f8",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "d2a79e8dde294e36945f538f21b48531",
"keywords": "算法初阶,快速排序,快速排序的描述,排序和顺序统计量"
}
\ No newline at end of file
# 排序
试题描述
由键盘上输入n个整数,请将这些数从大到小排序,然后输出排序后的数列。
输入
输入包含两行:
第一行是n(1 <= n <= 1000)。
第二行是n个整数,邻近两数之间用一个空格隔开。
输出
输出排序后的n个整数,邻近两数之间用一个空格隔开。
输入示例
5
8 2 5 1 2
输出示例
8 5 2 2 1
数据范围
输入和输出均为int范围的整数
## template
```cpp
#include<iostream>
using namespace std;
int main() {
int n,tmp;
cin >> n;
int *a = new int[n];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] < a[j]) {
tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
}
}
for (int i = 0; i < n; i++) {
cout << a[i];
if (i != n - 1)
cout << " ";
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-26432dc3e35a406690201c8b05e7100c",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "0fa88446d639403bb7c42e1e6f80a625",
"keywords": "算法初阶,基础知识,函数的增长,标准记号与常用函数"
}
\ No newline at end of file
# 字符数组
<p>编写一个以两个字符数组作为输入的函数。
如果第二个数组包含在第一个数组中&#xff0c;则函数返回第一个数组中第二个数组开始的第一个索引。
如果第二个数组不被包含在第一个数组&#xff0c;然后函数应该return -1
输入 [’c’,’a’,’l’,’l’,’i’,’n’,’g’] 和 [’a’,’l’,’l’]  就 return 1.
输入 [’c’,’a’,’l’,’l’,’i’,’n’,’g’] 和 [’a’,’n’] 就 return -1.</p>
## template
```cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
char a[128],b[128];
int numA, numB;
cout << "请输入第一个数组元素个数:";
cin >> numA;
cout << "请输入第一个数组元素:";
for (int i = 0; i < numA; ++i)
cin >> a[i];
cin.clear();
cin.sync();
cout << "请输入第二个数组元素个数:";
cin >> numB;
cout << "请输入第二个数组元素:";
for (int i = 0; i < numB; ++i)
cin >> b[i];
int num = 0;
string index;
for (int j = 0; j < numB; j++)
{
for (int k = 0; k < numA; k++)
{
if (b[j] == a[k])
{
index += to_string(k);
num++;
break;
}
}
}
if (num == numB)
{
cout << "第二个数组包含在第一个数组中" << endl;
cout << "第一个数组中第二个数组开始的第一个索引为:" << index.substr(0,1) << endl;
}
else
cout << "第二个数组不被包含在第一个数组";
system("pause");
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-02314c22b3ea40f087778df8be331d2b",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "36cfcc0e855e4cde8449cfb24e471727",
"keywords": "B树,算法高阶,高级数据结构,B树上的基本操作"
}
\ No newline at end of file
# 从键盘输入任意一个大写英文字母,要求它在26个字母表中的位置和其后面的第四个字母
例如:程序运行
输入:B<回车>
输出:B在第2个位置,其后面第四个字母是F
## template
```cpp
#include <stdio.h>
int main(){
char c,c2;
printf("输入:");
c = getchar();
int m=0,n=0;
if(c>='A'&& c<='z')
{
m = c - 'A' + 1;
if(m < 23)
{
c2 = c + 4;
n = m+4;
}
}
if(n > 0)
printf("%c在第%d个位置,其后面第四个字母是%c\n",c,m,c2);
else
printf("%c在第%d个位置,其后面没有第四个字母\n",c,m);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-06a0e922ceb94cba842194a19fb710fb",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "8d3e31bef80c485bb204d08d7c532243",
"keywords": "桶排序,算法初阶,线性时间排序,排序和顺序统计量"
}
\ No newline at end of file
# 按要求排序数组
<p>&nbsp;给你一个整数数组 arr 。请你将数组中的元素按照其二进制表示中,数字 1 的数目升序排序。 如果存在多个数字二进制中 1 的数目相同,则必须将它们按照数值大小升序排列。请你返回排序后的数组。</p>
## template
```cpp
#include<stdio.h>
#include<stdlib.h>
int oneNum(int x)
{
int cnt = 0;
while(x)
{
cnt++;
x = x&(x-1);
}
return cnt;
}
int cmp(const void *a,const void*b)
{
int al,bl;
int ret;
al = *(int*)a;
bl = *(int*)b;
ret = oneNum(al) - oneNum(bl);
return ret ? ret : al - bl;
}
int main()
{
int s[]={1,2,3,5,6,7,8},i;
int len = sizeof(s)/sizeof(*s);
qsort(s,len,4,cmp);
for(i = 0 ; i < len ; i++)
{
printf("%d\n",s[i]);
}
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-e22aa7f4699344e38010b961b7e90b0b",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "3a364cdce27b488087d0b038da23f998",
"keywords": "数学,算法"
}
\ No newline at end of file
# 检查一个3位数是否是水仙花数
检查一个3位数是否是水仙花数。
输入:一个数字,比如 371,输出:x是水仙花数,
如果不是,则输出:x不是水仙花数。
注:x为输入的数字
## template
```cpp
#include <iostream>
using namespace std;
int main()
{
int a, b, c, y, n = 0;
cout << "请输入三位数字:" << endl;
cin >> n;
a = n % 1000 / 100;
b = n % 100 / 10;
c = n % 10 / 1;
y = a*a*a + b*b*b + c*c*c;
if (y == n) cout << n << "是水仙花数" << endl;
else cout << n << "不是水仙花数" << endl;
system("pause");
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-7a9f91f6fb5a4479bb5059429e910d8c",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "253efcfc76d543c9911d2fd0e022e23f",
"keywords": "时间转换"
}
\ No newline at end of file
# 秒数转换
输入一个秒数,转换成HH:MM:SS的格式输出。
输入样例
365
输出样例
00:06:05
## template
```cpp
#include<cstdio>
int n;
void print(int x){
if(x==0)printf("00");
else if(x<10)printf("0%d",x);
else printf("%d",x);
return;
}
int main(){
scanf("%d",&n);
int s,f,m;
s=n/3600;
f=n/60%60;
m=n%60;
print(s);
printf(":");
print(f);
printf(":");
print(m);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-927c05f4f0cc498d87f5240bb69013b1",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "f6a830097bd34ae2b32cb1015a9fbad2",
"keywords": "算法,字符串"
}
\ No newline at end of file
# 找出string中只出现过一次的字符
找出string中只出现过一次的字符
例如"abcdef abcd"中需要得到ef
## template
```cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string temp = "";
    cout << "请输入字符串:";
    cin >> temp;
    string str = "";        
    string str1 = "";        
    for (int i = 0; i < temp.length(); i++)
    {
        string tempSub = temp.substr(i, 1);    
        int b = temp.rfind(tempSub);                
        if (i == b && str1.find(tempSub) == -1)        
            str +=temp.substr(i, 1);
        else if (str1.find(tempSub) == -1)
            str1 += temp.substr(i, 1);
    }
    cout << "只出现一次的字符:" << str << endl;
    cout << "重复出现的字符的字符:" << str1 << endl;
    system("pause");
    return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-16d8bf9ca858422293cab4a63d11d0ee",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "a0660c1ff1b349b6a58503a3b6c99dbf",
"keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量"
}
\ No newline at end of file
# 找出小于平均值的数。
<p>从键盘输入一个正整数存入变量n中&#xff0c;再输入n个整数&#xff0c;然后找出所有小于平均值的数&#xff0c;并按输入顺序输出。
 
 </p>
## template
```cpp
#include<stdio.h>
int main()
{
int i,n,sum=0,a[100];
float ave;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
ave=sum*1.0/n;
for(i=0;i<n;i++){
if(a[i]<ave)
printf("%d",a[i]);
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-31b232fe873646698ccfde07ef62a2df",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "ccd00d8423b44763960adb0cd515538e",
"keywords": "算法中阶,贪心算法,活动选择问题,高级设计和分析技术"
}
\ No newline at end of file
# 水果计费系统
<p>本关任务&#xff1a;编写程序&#xff0c;有五种水果&#xff0c;apple、banana、orage、strawberry、pear&#xff0c;每一种有一个价格&#xff08;浮点小数&#xff09;&#xff0c;由老板输入&#xff0c;请提示用户选择什么水果&#xff0c;购买数量&#xff08;按照斤两&#xff09;&#xff0c;然后将总价显示出来。</p>
## template
```cpp
#include<stdio.h>
int main(){
typedef enum {apple, banana, orange, strawberry, pear} fruits;
double prices[5];
fruits purchase;
int fruit;
double amount;
for(int i = 0; i < 5; i++)
scanf("%lf", &prices[i]);
printf("水果编号:1.苹果 2.香蕉 3.橘子 4.草莓 5.梨\n");
printf("请输入购买的水果(1~5),以及购买数量(按照斤两):\n");
scanf("%d %lf", &fruit, &amount);
purchase = (fruits)fruit;
printf("总价为:%.3lf", prices[purchase-1]*amount);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-22df2bc3bccc4c0aacf00251b43bb2bd",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "0e25906f699240c19576a92aff9f37ef",
"keywords": "数列,递归,数学运算"
}
\ No newline at end of file
# 用递归求第n项的值
1,2,4,2,3,6,12,6,3,....求第n项值
## template
```cpp
#include <stdio.h>
int fun(int n,int *x,int *y)
{
int sum = 0,i;
int size = 0;
int dd = 1;
for (i = 1; i <= (*x);i++)
{
sum += (2*i-1);
}
if (sum == n)
{
*y = 2*(*x) -1;
return (*x);
}else if (sum > n)
{
(*y) = n - (sum - (2 * (*x) -1));
size = 2* (*x) -1;
dd = (*x);
for (i = 2; i <= (*y);i++)
{
if(i <= (*x))
dd *= 2;
else
dd /= 2;
}
return dd;
}else
{
(*x)++;
return fun(n,x,y);
}
}
int main()
{
int n;
int row = 1,col = 0;
int val;
row = 1;
col = 0;
printf("请输入n:");
scanf("%d",&n);
val = fun(n,&row,&col);
printf("第%d项是:%d\n",n,val);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-83b2c25568134ccab795b09d81b135f9",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "9eed791912c84c80b4b83bf3e51d03a1",
"keywords": "B树,算法高阶,高级数据结构,B树上的基本操作"
}
\ No newline at end of file
# 计算字符串逆序数
例如:字符串中的内容为:a1Ab1D2,1<A,A<b 1<D 则调用该函数后,返回码为:3。 
## template
```cpp
#include <iostream>
#include <string>
using namespace std;
int solve(string s)
{
if (s.length() == 0) return 0;
int n = 0;
for (int i = 1; i < s.length(); i++)
if (s.c_str()[i] < s.c_str()[i - 1]) n++;
return n;
}
int main()
{
string s = "a1Ab1D2";
int n = solve(s);
cout << n << endl;
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-4e3b4cff80674a318a229cd5c8791b2a",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "91c323f9f15544c3b2cba964610b8587",
"keywords": "B树,算法高阶,高级数据结构,B树上的基本操作"
}
\ No newline at end of file
# if else 和 switch 使用
<p>输入学生成绩&#xff0c;
若成绩在95分以上&#xff0c;输出“A”&#xff1b;
若成绩在85~94分&#xff0c;输出“B”&#xff1b;
若成绩在75~84分&#xff0c;输出“C”&#xff1b;
若成绩在65~74分&#xff0c;输出“D”&#xff1b;
若成绩在65分以下&#xff0c;输出“E”。&#xff08;分别用if else 和 switch 语句完成&#xff09;</p>
## template
```cpp
#include "stdio.h"
int main(){
int score;
scanf("%d",&score);
if(score>=95){
printf("A\n");
}else if(score>=85 && score<=94){
printf("B\n");
}else if(score>=75 && score<=84){
printf("C\n");
}else if(score>=65 && score<=74){
printf("D\n");
}else{
printf("E\n");
}
printf("以下用switch语句实现相同功能\n");
score = score-5;
score = score/10;
switch(score){
case 9:
printf("A\n");
break;
case 8:
printf("B");
break;
case 7:
printf("C\n");
break;
case 6:
printf("D\n");
break;
default:
printf("E\n");
break;
}
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-db39972a67974a50b6b28e5faa129aa6",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "9e6bc51acdf44c64ae58d8891c769c0b",
"keywords": "图算法,算法高阶,最小生成树,最小生成树的形成"
}
\ No newline at end of file
# 将字符串2小写字母复制到字符串1
<p>编写程序,输入字符串s2,将其中所有小写字母复制到字符串数组strl中。例如<br />
aal1bb22cc33de4AA55BB”,生成的strl为&#34;aabbccde&#34;</p>
## template
```cpp
#include<stdio.h>
int main()
{
int sum=0,t=0,i;
char s[50],s1[50];
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
if(s[i]>='a'&&s[i]<='z'){
s1[t++]=s[i];
}
}
s1[t]='\0';
printf("%s",s1);
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-18fc61b230304d109c0a47245b2c9aa0",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "d73526e1aaf443009e8ed3a3201d823d",
"keywords": "递归,算法"
}
\ No newline at end of file
# 编写递归函数和非递归函数
<p>编写一个递归函数和一个非递归函数&#xff0c;分别实现求1&#43;2&#43;3&#43;...&#43;n</p>
## template
```cpp
#include <stdio.h>
int sum(int n)
{
if(n == 1)
return 1;
else
return n + sum(n-1);
}
int sum_2(int n)
{
int ss = 0;
for (int i = 1; i <=n;i++)
{
ss += i;
}
return ss;
}
int main()
{
int n;
printf("请输入n:");
scanf("%d",&n);
if(n == 0)
{
printf("请输入正整数n");
return -1;
}
int s1 = sum(n);
int s2 = sum_2(n);
printf("递归计算=%d;循环计算=%d\n",s1,s2);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-70a39eaf8f054d33b89aad6f5f3fb871",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "15ca2c332f8747dd9dcaa802ecde5b44",
"keywords": "数列,数学运算"
}
\ No newline at end of file
# 求数列第n项值
<p>求数列第n项值&#xff1a;1,2,3,6,11,20,37,68,125,230,.....例如:第7项为37&#xff0c;第9项为125。</p>
## template
```cpp
#include <stdio.h>
int main(void) {
int n;
printf("请输入n的值:");
scanf("%d",&n);
if(n==1){
printf("第1项为1\n");
}else if(n==2){
printf("第2项为2\n");
}else if(n==3){
printf("第3项为3\n");
}else{
int f1=1,f2=2,f3=3;
int i,fn;
for(i=4;i<=n;i++){
fn=f1+f2+f3;
f1=f2;
f2=f3;
f3=fn;
}
printf("第%d项为%d\n",n,fn);
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-8b7bc583ff9c423f9a3a5e2f768984ea",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "455e33582b8745ab8f41fc09e6adad82",
"keywords": "图算法,算法高阶,最小生成树,最小生成树的形成"
}
\ No newline at end of file
# 找出字符串中出现最多的字母
Description
钟Sir是一个迷信的(superstitious)家伙。他相信每一个字符串(string)里都有一个幸运字符。我们可以通过以下方法找到这个字符。例如,在字符串abbccc中,c 出现的次数最多,所以这个幸运字符就是 c 啦!(>_<)  (钟Sir的想法好简单啊…)
Input
第一行是测试数据的组数n,接下来的每组测试数据占一行,每行数据不超过1000个字符且非空。
字符串里只含小写字母。
Output
每组数据对应输出一行,包括出现次数最多的字符和该字符出现的次数,中间是一个空格。如果有多个字符出现的次数相同且最多,那么输出ASCII码最小的那一个字符。
Sample Input
2
abbccc
adfadffasdf
Sample Output
c 3
f 4
## template
```cpp
#include <string.h>
#include"stdio.h"
int main(void)
{
int n,i, z[26], max, xia;
char c[1050], ch;
scanf("%d",&n);
while(n>0)
{
n--;
scanf("%s", c);
for(i=0; i<26; i++)
z[i]=0;
xia=strlen(c);
for(i=0; i<xia; i++)
z[c[i]-'a']++;
max=z[0]; xia=0;
for(i=1; i<=25; i++)
if(z[i]>max){
max=z[i];
xia=i;
}
ch='a'+xia;
printf("%c %d\n", ch, max);
}
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-70b1adc8c0834314ae6fbf51477e95e3",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "9f7f3dcf9c4c437fb1d6a5348f308453",
"keywords": "循环"
}
\ No newline at end of file
# 不同方式求n的阶乘
<p>求n的阶乘&#xff08;用三种不同的循环实现&#xff0c;提示&#xff1a;先从键盘输入n的值&#xff09;while、do while和for</p>
## template
```cpp
#include <stdio.h>
int main(void) {
int n;
printf("请输入n的值:");
scanf("%d",&n);
int temp=n,sum=1;
while(temp>1){
sum*=temp;
temp--;
}
printf("%d的阶乘是%d\n",n,sum);
temp=n;
sum=1;
do{
sum*=temp;
temp--;
}while(temp>1);
printf("%d的阶乘是%d\n",n,sum);
temp=n;
sum=1;
for(;temp>1;temp--){
sum*=temp;;
}
printf("%d的阶乘是%d\n",n,sum);
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-c72f6867061946e9968b2297a8051238",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "d70ed1dbad074ec3afbd48f64094dc75",
"keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配"
}
\ No newline at end of file
# 字符串的处理
<p>给定一个正整数N和一个由小写英文字母组成的长度N的字符串S。确定该字符串是否是某个字符串的两个副本的连接。也就是说&#xff0c;确定是否存在一个字符串T使S&#61;T&#43;T。如果S是某个字符串的两个副本的连接&#xff0c;则输出Yes;否则,直接输出No。
例如&#xff0c;输入6&#xff08;回车&#xff09;abcabc&#xff0c;输出Yes&#xff08;回车&#xff09;Let T&#61;abc&#xff0c;and S&#61;T&#43;T。
或者输入4&#xff08;回车&#xff09;abac&#xff0c;输出No&#xff08;回车&#xff09;结束。</p>
## template
```cpp
#include <stdio.h>
int main() {
int len,i,judge=0;
scanf("%d", &len);
char a[len+1];
scanf("%s", a);
if(len%2==0) {
for(i=0;i<(len/2);i++)
if(a[i]!=a[(len/2)+i]){
judge=1;
break;
}
if(judge==1)
printf("No");
else {
printf("Yes");
}
} else
printf("No");
printf("\n");
return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-c3caf7834f9349d5b1b6a929ec8421e8",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
{
"type": "code_options",
"author": "csdn.net",
"source": "solution.md",
"exercise_id": "9c8ae3b302f346f09bac14759a1721bf",
"keywords": "数列"
}
\ No newline at end of file
# 怎么求尾数与常数之和?
<p>数列的前3项都为1&#xff0c;从第4项开始&#xff0c;每项都是其前3项的和&#xff1a;1, 1, 1, 3, 5, 9, 17, … 请你编程求出数列第N项的<strong>4位尾数</strong>与90000之和。输入一个正整数N&#xff0c;输出所求的和。</p>
## template
```cpp
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <set>
using namespace std;
#define NUM 10000
long long dp[1000000];
int main(){
    int n;
    cin>>n;
    dp[1]=1;
    dp[2]=1;
    dp[3]=1;
    for(int i=4;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
    }
    cout<<dp[n]<<endl;
    long long x=dp[n]%NUM+90000;
    cout<<x;
    system("pause");
    return 0;
}
```
## 答案
```cpp
```
## 选项
### A
```cpp
```
### B
```cpp
```
### C
```cpp
```
\ No newline at end of file
{
"node_id": "dailycode-96f4e45c16414e43983cf3462376a1fe",
"keywords": [],
"children": [],
"export": [
"solution.json"
]
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册