Mattylyh
Mattylyh
全部文章
分类
题解(18)
归档
标签
去牛客网
登录
/
注册
Mattylyh的博客
全部文章
(共18篇)
题解 | #拆分词句#
从前往后通过int i遍历遍历, 看看前i个是否能分割后被字典找到, 假如可以就设置i下标的boolean值为true, 这个boolean值可以被后面的遍历所利用, 相当于记录下了之前的结果. import java.util.Set; public class ...
Java
动态规划
2022-10-28
0
401
题解 | #图片整理#
#include <stdio.h> int main() { char arr[1000] = { 0 }; gets(arr); int n = 0, i = 0, j = 0; while (arr[n] != '\0') n++; char tmp = 0; for (i =...
C
2022-06-20
0
397
题解 | #记负均正#
int main() { int n = 0; while (~scanf("%d", &n)) { int tmp = 0; int sum = 0; int c = 0; int i = n; float n1 = (float)n; while (i) { scanf("%d",&am...
C
2022-02-27
0
251
题解 | #等差数列#
int d(int n) { int sum = 2; int ret = sum; while (n-1) { sum = 2; sum += (n-1) * 3; ret += sum; n--; } return ret; } int main() { int n = 0; while (~s...
C
2022-02-27
0
289
题解 | #尼科彻斯定理#
int c(int n) { int i = n - 1; int c = i; if (i == 0) return 1; else { while (i) c += (--i); } return c; } void print(int n,int c) { int j = 0; if (n =...
C
2022-02-27
0
265
题解 | #带空格直角三角形图案#
int main() { int n = 0; while (~scanf("%d", &n)) { int i = 0; int tmp = n; while (tmp--) { for (i = 1; i <= tmp; i++) printf(" "); for (i = 1;...
C
2022-02-20
0
268
题解 | #序列中删除指定数字#
int main() { int n = 0; scanf("%d", &n); int arr[50] = { 0 }; int a = 0; int b = 0; for (a; a < n; a++) scanf("%d", &arr[a]); int del = 0...
C
2022-02-20
0
264
题解 | #小乐乐排电梯#
int main() { int n = 0; scanf("%d", &n); int m = 0; if (n < 12) m = 2; else { while (n >= 12) { m += 4; n -= 12; } m += 2; } printf("%d", m)...
C
2022-02-19
0
341
题解 | #小乐乐走台阶#
```int fib(int n) { if (n == 1) return 1; if (n == 2) return 2; else return fib(n - 1) + fib(n - 2); } int main() { int n = 0; while (~scan...
C
2022-02-19
0
283
题解 | #反向输出一个四位数#
#include <stdio.h> int main() { int a,z,x,c,v; scanf("%d",&a); z =a/1000; x =a/100-z*10; c =a/10-z*100-x*10; v =a-z*...
C
2021-10-31
0
290
首页
上一页
1
2
下一页
末页