Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_algorithm
提交
83593f32
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看板
提交
83593f32
编写于
10月 28, 2021
作者:
每日一练社区
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update exercises
上级
8dceb2d8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
290 addition
and
9 deletion
+290
-9
data/1.算法初阶/1.蓝桥杯/单词分析/solution.md
data/1.算法初阶/1.蓝桥杯/单词分析/solution.md
+118
-4
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.cpp
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.cpp
+1
-1
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.md
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.md
+171
-4
未找到文件。
data/1.算法初阶/1.蓝桥杯/单词分析/solution.md
浏览文件 @
83593f32
...
...
@@ -31,7 +31,8 @@ o 6
## aop
### before
```
cpp
#include "stdio.h"
#include "string.h"
```
### after
```
cpp
...
...
@@ -40,21 +41,134 @@ o 6
## 答案
```
cpp
int
main
()
{
int
a
[
128
]
=
{
0
};
char
s
[
1000
];
scanf
(
"%s"
,
s
);
int
len
=
strlen
(
s
);
int
max
=
0
;
char
t
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
a
[
s
[
i
]]
++
;
if
(
max
<
a
[
s
[
i
]])
{
max
=
a
[
s
[
i
]];
t
=
s
[
i
];
}
else
if
(
max
==
a
[
s
[
i
]])
{
if
(
t
>
s
[
i
])
{
t
=
s
[
i
];
}
}
}
printf
(
"%c
\n
%d"
,
t
,
max
);
}
```
## 选项
### A
```
cpp
int
main
()
{
int
a
[
128
]
=
{
0
};
char
s
[
1000
];
scanf
(
"%s"
,
s
);
int
len
=
strlen
(
s
);
int
max
=
0
;
char
t
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
a
[
s
[
i
]]
++
;
if
(
max
>
a
[
s
[
i
]])
{
max
=
a
[
s
[
i
]];
t
=
s
[
i
];
}
else
if
(
max
==
a
[
s
[
i
]])
{
if
(
t
>
s
[
i
])
{
t
=
s
[
i
];
}
}
}
printf
(
"%c
\n
%d"
,
t
,
max
);
}
```
### B
```
cpp
int
main
()
{
int
a
[
128
]
=
{
0
};
char
s
[
1000
];
scanf
(
"%s"
,
s
);
int
len
=
strlen
(
s
);
int
max
=
0
;
char
t
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
a
[
s
[
i
]]
++
;
if
(
max
>
a
[
s
[
i
]])
{
max
=
a
[
s
[
i
]];
t
=
s
[
i
+
1
];
}
else
if
(
max
==
a
[
s
[
i
]])
{
if
(
t
>
s
[
i
])
{
t
=
s
[
i
];
}
}
}
printf
(
"%c
\n
%d"
,
t
,
max
);
}
```
### C
```
cpp
int
main
()
{
int
a
[
128
]
=
{
0
};
char
s
[
1000
];
scanf
(
"%s"
,
s
);
int
len
=
strlen
(
s
);
int
max
=
0
;
char
t
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
a
[
s
[
i
]]
++
;
if
(
max
<
a
[
s
[
i
]])
{
max
=
a
[
s
[
i
]];
t
=
s
[
i
+
1
];
}
else
if
(
max
==
a
[
s
[
i
]])
{
if
(
t
>
s
[
i
])
{
t
=
s
[
i
];
}
}
}
printf
(
"%c
\n
%d"
,
t
,
max
);
}
```
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.cpp
浏览文件 @
83593f32
...
...
@@ -32,7 +32,7 @@ int main()
{
for
(
int
c
=
0
;
c
<
v
;
c
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
-
1
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
-
1
][
c
])
%
MOD
;
}
}
...
...
data/1.算法初阶/1.蓝桥杯/地宫取宝/solution.md
浏览文件 @
83593f32
...
...
@@ -44,7 +44,13 @@ X 国王有一个地宫宝库,是 n×m 个格子的矩阵,每个格子放一
## aop
### before
```
cpp
#include <iostream>
using
namespace
std
;
const
int
N
=
55
;
const
int
MOD
=
1e9
+
7
;
int
dp
[
N
][
N
][
13
][
14
];
int
g
[
N
][
N
];
int
n
,
m
,
k
;
```
### after
```
cpp
...
...
@@ -53,21 +59,182 @@ X 国王有一个地宫宝库,是 n×m 个格子的矩阵,每个格子放一
## 答案
```
cpp
int
main
()
{
cin
>>
n
>>
m
>>
k
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
cin
>>
g
[
i
][
j
];
g
[
i
][
j
]
++
;
}
}
dp
[
1
][
1
][
1
][
g
[
1
][
1
]]
=
1
;
dp
[
1
][
1
][
0
][
0
]
=
1
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
for
(
int
u
=
0
;
u
<=
k
;
u
++
)
{
for
(
int
v
=
0
;
v
<=
13
;
v
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
v
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
][
v
])
%
MOD
;
if
(
u
>
0
&&
v
==
g
[
i
][
j
])
{
for
(
int
c
=
0
;
c
<
v
;
c
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
-
1
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
-
1
][
c
])
%
MOD
;
}
}
}
}
}
}
int
res
=
0
;
for
(
int
i
=
0
;
i
<=
13
;
i
++
)
res
=
(
res
+
dp
[
n
][
m
][
k
][
i
])
%
MOD
;
cout
<<
res
<<
endl
;
return
0
;
}
```
## 选项
### A
```
cpp
int
main
()
{
cin
>>
n
>>
m
>>
k
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
cin
>>
g
[
i
][
j
];
g
[
i
][
j
]
++
;
}
}
dp
[
1
][
1
][
1
][
g
[
1
][
1
]]
=
1
;
dp
[
1
][
1
][
0
][
0
]
=
1
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
for
(
int
u
=
0
;
u
<=
k
;
u
++
)
{
for
(
int
v
=
0
;
v
<=
13
;
v
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
v
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
][
v
])
%
MOD
;
if
(
u
>
0
&&
v
==
g
[
i
][
j
])
{
for
(
int
c
=
0
;
c
<
v
;
c
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
][
u
-
1
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
-
1
][
c
])
%
MOD
;
}
}
}
}
}
}
int
res
=
0
;
for
(
int
i
=
0
;
i
<=
13
;
i
++
)
res
=
(
res
+
dp
[
n
][
m
][
k
][
i
])
%
MOD
;
cout
<<
res
<<
endl
;
return
0
;
}
```
### B
```
cpp
int
main
()
{
cin
>>
n
>>
m
>>
k
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
cin
>>
g
[
i
][
j
];
g
[
i
][
j
]
++
;
}
}
dp
[
1
][
1
][
1
][
g
[
1
][
1
]]
=
1
;
dp
[
1
][
1
][
0
][
0
]
=
1
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
for
(
int
u
=
0
;
u
<=
k
;
u
++
)
{
for
(
int
v
=
0
;
v
<=
13
;
v
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
v
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
][
v
])
%
MOD
;
if
(
u
>
0
&&
v
==
g
[
i
][
j
])
{
for
(
int
c
=
0
;
c
<
v
;
c
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
-
1
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
][
u
-
1
][
c
])
%
MOD
;
}
}
}
}
}
}
int
res
=
0
;
for
(
int
i
=
0
;
i
<=
13
;
i
++
)
res
=
(
res
+
dp
[
n
][
m
][
k
][
i
])
%
MOD
;
cout
<<
res
<<
endl
;
return
0
;
}
```
### C
```
cpp
int
main
()
{
cin
>>
n
>>
m
>>
k
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
cin
>>
g
[
i
][
j
];
g
[
i
][
j
]
++
;
}
}
dp
[
1
][
1
][
1
][
g
[
1
][
1
]]
=
1
;
dp
[
1
][
1
][
0
][
0
]
=
1
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
m
;
j
++
)
{
for
(
int
u
=
0
;
u
<=
k
;
u
++
)
{
for
(
int
v
=
0
;
v
<=
13
;
v
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
v
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
][
v
])
%
MOD
;
if
(
u
>
0
&&
v
==
g
[
i
][
j
])
{
for
(
int
c
=
0
;
c
<
v
;
c
++
)
{
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
-
1
][
j
][
u
][
c
])
%
MOD
;
dp
[
i
][
j
][
u
][
v
]
=
(
dp
[
i
][
j
][
u
][
v
]
+
dp
[
i
][
j
-
1
][
u
-
1
][
c
])
%
MOD
;
}
}
}
}
}
}
int
res
=
0
;
for
(
int
i
=
0
;
i
<=
13
;
i
++
)
res
=
(
res
+
dp
[
n
][
m
][
k
][
i
])
%
MOD
;
cout
<<
res
<<
endl
;
return
0
;
}
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录