Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_algorithm
提交
41c78088
S
skill_tree_algorithm
项目概览
CSDN 技术社区
/
skill_tree_algorithm
通知
9
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_algorithm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
“c4bb667eaf520f21b3a3db0489682becc9c49bcc”上不存在“include/uapi/git@gitcode.net:openeuler/kernel.git”
提交
41c78088
编写于
3年前
作者:
每日一练社区
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update exercises
上级
908ee98e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
228 addition
and
76 deletion
+228
-76
data/1.算法初阶/1.蓝桥杯/分类计数/solution.md
data/1.算法初阶/1.蓝桥杯/分类计数/solution.md
+106
-4
data/1.算法初阶/1.蓝桥杯/分配口罩/solution.md
data/1.算法初阶/1.蓝桥杯/分配口罩/solution.md
+53
-3
data/1.算法初阶/1.蓝桥杯/斐波那契/solution.md
data/1.算法初阶/1.蓝桥杯/斐波那契/solution.md
+69
-1
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/config.json
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/config.json
+0
-7
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/desc.md
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/desc.md
+0
-3
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.cpp
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.cpp
+0
-0
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.java
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.java
+0
-24
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.md
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.md
+0
-34
未找到文件。
data/1.算法初阶/1.蓝桥杯/分类计数/solution.md
浏览文件 @
41c78088
...
@@ -26,7 +26,8 @@
...
@@ -26,7 +26,8 @@
## aop
## aop
### before
### before
```
cpp
```
cpp
#include <iostream>
using
namespace
std
;
```
```
### after
### after
```
cpp
```
cpp
...
@@ -35,21 +36,122 @@
...
@@ -35,21 +36,122 @@
## 答案
## 答案
```
cpp
```
cpp
int
main
(
int
argc
,
char
**
argv
)
{
string
str
;
cin
>>
str
;
int
A
=
0
,
a
=
0
,
number
=
0
;
int
len
=
str
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
str
[
i
]
<=
'9'
&&
str
[
i
]
>=
'0'
)
{
number
++
;
}
if
(
str
[
i
]
<=
'Z'
&&
str
[
i
]
>=
'A'
)
{
A
++
;
}
if
(
str
[
i
]
<=
'z'
&&
str
[
i
]
>=
'a'
)
{
a
++
;
}
}
cout
<<
A
<<
endl
;
cout
<<
a
<<
endl
;
cout
<<
number
<<
endl
;
return
0
;
}
```
```
## 选项
## 选项
### A
### A
```
cpp
```
cpp
int
main
(
int
argc
,
char
**
argv
)
{
string
str
;
cin
>>
str
;
int
A
=
0
,
a
=
0
,
number
=
0
;
int
len
=
str
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
str
[
i
]
<
'9'
&&
str
[
i
]
>
'0'
)
{
number
++
;
}
if
(
str
[
i
]
<
'Z'
&&
str
[
i
]
>
'A'
)
{
A
++
;
}
if
(
str
[
i
]
<
'z'
&&
str
[
i
]
>
'a'
)
{
a
++
;
}
}
cout
<<
A
<<
endl
;
cout
<<
a
<<
endl
;
cout
<<
number
<<
endl
;
return
0
;
}
```
```
### B
### B
```
cpp
```
cpp
int
main
(
int
argc
,
char
**
argv
)
{
string
str
;
cin
>>
str
;
int
A
=
0
,
a
=
0
,
number
=
0
;
int
len
=
str
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
str
[
i
]
<
71
&&
str
[
i
]
>
60
)
{
number
++
;
}
if
(
str
[
i
]
<
132
&&
str
[
i
]
>
101
)
{
A
++
;
}
if
(
str
[
i
]
<
172
&&
str
[
i
]
>
141
)
{
a
++
;
}
}
cout
<<
A
<<
endl
;
cout
<<
a
<<
endl
;
cout
<<
number
<<
endl
;
return
0
;
}
```
```
### C
### C
```
cpp
```
cpp
int
main
(
int
argc
,
char
**
argv
)
{
string
str
;
cin
>>
str
;
int
A
=
0
,
a
=
0
,
number
=
0
;
int
len
=
str
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
str
[
i
]
<
39
&&
str
[
i
]
>
30
)
{
number
++
;
}
if
(
str
[
i
]
<
132
&&
str
[
i
]
>
101
)
{
A
++
;
}
if
(
str
[
i
]
<=
'z'
&&
str
[
i
]
>=
'a'
)
{
a
++
;
}
}
cout
<<
A
<<
endl
;
cout
<<
a
<<
endl
;
cout
<<
number
<<
endl
;
return
0
;
}
```
```
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/分配口罩/solution.md
浏览文件 @
41c78088
...
@@ -14,30 +14,80 @@ masks = [9090400, 8499400, 5926800, 8547000, 4958200, 4422600, 5751200, 4175600,
...
@@ -14,30 +14,80 @@ masks = [9090400, 8499400, 5926800, 8547000, 4958200, 4422600, 5751200, 4175600,
## aop
## aop
### before
### before
```
cpp
```
cpp
#include <iostream>
#include <algorithm>
#include <cmath>
using
namespace
std
;
long
int
masks
[
15
]
=
{
9090400
,
8499400
,
5926800
,
8547000
,
4958200
,
4422600
,
5751200
,
4175600
,
6309600
,
5865200
,
6604400
,
4635000
,
10663400
,
8087200
,
4554000
};
long
ans
=
1000000000
;
```
```
### after
### after
```
cpp
```
cpp
int
main
()
{
dfs
(
0
,
0
,
0
);
cout
<<
ans
;
}
```
```
## 答案
## 答案
```
cpp
```
cpp
void
dfs
(
int
n
,
long
h1
,
long
h2
)
{
if
(
n
==
15
)
{
ans
=
min
(
ans
,
abs
(
h1
-
h2
));
return
;
}
dfs
(
n
+
1
,
h1
+
masks
[
n
],
h2
);
dfs
(
n
+
1
,
h1
,
h2
+
masks
[
n
]);
}
```
```
## 选项
## 选项
### A
### A
```
cpp
```
cpp
void
dfs
(
int
n
,
long
h1
,
long
h2
)
{
if
(
n
==
15
)
{
ans
=
min
(
ans
,
abs
(
h1
-
h2
));
return
;
}
dfs
(
n
+
1
,
h1
+
masks
[
n
+
1
],
h2
);
dfs
(
n
+
1
,
h1
,
h2
+
masks
[
n
+
1
]);
}
```
```
### B
### B
```
cpp
```
cpp
void
dfs
(
int
n
,
long
h1
,
long
h2
)
{
if
(
n
==
15
)
{
ans
=
min
(
ans
,
abs
(
h1
-
h2
));
return
;
}
dfs
(
n
+
1
,
h1
+
masks
[
n
+
1
],
h2
);
dfs
(
n
+
1
,
h1
,
h2
+
masks
[
n
]);
}
```
```
### C
### C
```
cpp
```
cpp
void
dfs
(
int
n
,
long
h1
,
long
h2
)
{
if
(
n
==
15
)
{
ans
=
min
(
ans
,
abs
(
h1
-
h2
));
return
;
}
dfs
(
n
,
h1
+
masks
[
n
],
h2
);
dfs
(
n
,
h1
,
h2
+
masks
[
n
]);
}
```
```
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契/solution.md
浏览文件 @
41c78088
...
@@ -30,7 +30,7 @@ Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。
...
@@ -30,7 +30,7 @@ Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。
## aop
## aop
### before
### before
```
cpp
```
cpp
#include <stdio.h>
```
```
### after
### after
```
cpp
```
cpp
...
@@ -39,21 +39,89 @@ Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。
...
@@ -39,21 +39,89 @@ Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。
## 答案
## 答案
```
cpp
```
cpp
int
main
()
{
int
n
,
b
;
scanf
(
"%d"
,
&
n
);
int
a
[
n
];
a
[
0
]
=
a
[
1
]
=
1
;
for
(
int
i
=
2
;
i
<
n
;
i
++
)
{
a
[
i
]
=
(
a
[
i
-
1
]
+
a
[
i
-
2
])
%
10007
;
b
=
a
[
i
];
}
if
(
n
>
2
)
printf
(
"%d"
,
b
);
else
printf
(
"1"
);
return
0
;
}
```
```
## 选项
## 选项
### A
### A
```
cpp
```
cpp
int
main
()
{
int
n
,
b
;
scanf
(
"%d"
,
&
n
);
int
a
[
n
];
a
[
0
]
=
a
[
1
]
=
1
;
for
(
int
i
=
2
;
i
<
n
;
i
++
)
{
a
[
i
]
=
(
a
[
i
-
1
]
+
a
[
i
-
2
])
%
10007
;
b
=
a
[
i
]
+
1
;
}
if
(
n
>
2
)
printf
(
"%d"
,
b
);
else
printf
(
"1"
);
return
0
;
}
```
```
### B
### B
```
cpp
```
cpp
int
main
()
{
int
n
,
b
;
scanf
(
"%d"
,
&
n
);
int
a
[
n
];
a
[
0
]
=
a
[
1
]
=
1
;
for
(
int
i
=
2
;
i
<
n
;
i
++
)
{
a
[
i
]
=
(
a
[
i
-
1
]
+
a
[
i
-
2
])
%
10007
;
b
=
a
[
i
-
1
];
}
if
(
n
>
2
)
printf
(
"%d"
,
b
);
else
printf
(
"1"
);
return
0
;
}
```
```
### C
### C
```
cpp
```
cpp
int
main
()
{
int
n
,
b
;
scanf
(
"%d"
,
&
n
);
int
a
[
n
];
a
[
0
]
=
a
[
1
]
=
1
;
for
(
int
i
=
2
;
i
<
n
;
i
++
)
{
a
[
i
]
=
(
a
[
i
-
1
]
+
a
[
i
-
2
])
%
10007
;
b
=
a
[
i
-
2
];
}
if
(
n
>
2
)
printf
(
"%d"
,
b
);
else
printf
(
"1"
);
return
0
;
}
```
```
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/config.json
已删除
100644 → 0
浏览文件 @
908ee98e
{
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/desc.md
已删除
100644 → 0
浏览文件 @
908ee98e
#### 问题描述
斐波那契数列满足 F1 = F2 = 1,从 F3 开始有 Fn = Fn−1 + Fn−2。请你计算 GCD(F2020, F520),其中 GCD(A, B) 表示 A 和 B 的最大公约数。
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.cpp
已删除
100644 → 0
浏览文件 @
908ee98e
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.java
已删除
100644 → 0
浏览文件 @
908ee98e
import
java.math.BigInteger
;
public
class
BigNumber
{
public
static
void
main
(
String
[]
args
)
{
BigInteger
a
=
new
BigInteger
(
"1"
);
BigInteger
b
=
new
BigInteger
(
"1"
);
BigInteger
[]
fib
=
new
BigInteger
[
2030
];
fib
[
1
]
=
a
;
fib
[
2
]
=
b
;
for
(
int
x
=
3
;
x
<
fib
.
length
;
x
++)
{
fib
[
x
]
=
fib
[
x
-
1
].
add
(
fib
[
x
-
2
]);
}
a
=
fib
[
2020
];
b
=
fib
[
520
];
BigInteger
temp
;
while
(
b
!=
BigInteger
.
ZERO
)
{
temp
=
a
.
mod
(
b
);
a
=
b
;
b
=
temp
;
}
System
.
out
.
println
(
a
);
}
}
This diff is collapsed.
Click to expand it.
data/1.算法初阶/1.蓝桥杯/斐波那契数列最大公约数/solution.md
已删除
100644 → 0
浏览文件 @
908ee98e
# 斐波那契数列最大公约数
#### 问题描述
斐波那契数列满足 F1 = F2 = 1,从 F3 开始有 Fn = Fn−1 + Fn−2。请你计算 GCD(F2020, F520),其中 GCD(A, B) 表示 A 和 B 的最大公约数。
## aop
### before
```
cpp
```
### after
```
cpp
```
## 答案
```
cpp
```
## 选项
### A
```
cpp
```
### B
```
cpp
```
### C
```
cpp
```
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部