上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: 带分数: 可以表示为带分数的形式:100=3+69258 / 714 ; 还可以表示为:100=82+3546 / 197 ; 注意特征:带分数中,数字 1∼91∼9 分别出现且只出现一次(不包含 00)。 类似这样的带分数,100 有 11 种表示法。 输入格式 一个正整数。 输出格式 输出输入数 阅读全文
posted @ 2021-03-29 16:04 荣荣荣荣荣荣 阅读(106) 评论(0) 推荐(0)
摘要: 剪邮票 有12张连在一起的的12生肖邮票,现在你要从中剪下5张来,要求必须是连着的。(仅仅连接一个角不算相连)请你计算,一共有多少种不同的剪去方法。 看到这个题一开始我直接认为DFS搜索12次就行了。 肯定没那么简单。因为有几种情况是搜索不到的,比如: 可以转换成一个思路,就是随机找个5张邮票,看它 阅读全文
posted @ 2021-03-22 10:22 荣荣荣荣荣荣 阅读(53) 评论(0) 推荐(0)
摘要: 【问题描述】 将2019拆分为若干个两两不同的质数之和,一共有多少种不同的方法? 注意交换顺序为同一种方法,列如2 + 2019 = 2019 与 2017 + 2 = 2019 视为同一种方法。 #include <stdio.h> #include <string.h> int n, m; in 阅读全文
posted @ 2021-03-19 20:17 荣荣荣荣荣荣 阅读(72) 评论(0) 推荐(0)
摘要: 大数据求阶乘,例如求 1977! #include "stdio.h" int main() { int i, j, n, num[10005]; int x = 0, y, len = 1; n = 1977; num[0] = 1; for(i = 2; i <= n; i++) { for(j 阅读全文
posted @ 2021-03-15 17:45 荣荣荣荣荣荣 阅读(123) 评论(0) 推荐(0)
摘要: 核心代码: for(i = 1; i <= n; i++){ pre[i][i] = a[i]; for(j = i + 1; j <= n; j++){ pre[i][j] = a[j] * pre[i][j - 1] % mod; printf("pre[%d][%d] = %d ",i,j,p 阅读全文
posted @ 2021-02-27 20:11 荣荣荣荣荣荣 阅读(102) 评论(0) 推荐(0)
摘要: 样例输入 10 3 18 7 14 10 12 23 41 16 24 样例输出 6 #include <stdio.h> int a[1005], dp[1005]; int main() { int i, j, l, max; int n; scanf("%d",&n); for(i = 1; 阅读全文
posted @ 2021-02-01 17:55 荣荣荣荣荣荣 阅读(76) 评论(0) 推荐(0)
摘要: 样例输入 I am a student 样例输出 student 1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 char a[100005], b[100005]; 6 int i, num = 0; 7 while (s 阅读全文
posted @ 2021-01-28 20:31 荣荣荣荣荣荣 阅读(102) 评论(0) 推荐(0)
摘要: 题目描述 小朋友排成一排,老师给他们分苹果。小朋友从左到右标号1..N。有M个老师,每次第i个老师会给第Li个到第Ri个,一共Ri-Li+1个小朋友每人发Ci个苹果。最后老师想知道每个小朋友有多少苹果。 输入 第一行两个整数N、M,表示小朋友个数和老师个数。 接下来M行,每行三个整数Li、Ri、Ci 阅读全文
posted @ 2021-01-27 18:52 荣荣荣荣荣荣 阅读(94) 评论(0) 推荐(0)
摘要: 样例输入 one little two little three little boys 样例输出 5学会将一个字符串分为多个字符串比较。 1 #include <stdio.h> 2 #include <string.h> 3 4 char a[10100]; 5 int f(){ 6 int i 阅读全文
posted @ 2021-01-27 14:48 荣荣荣荣荣荣 阅读(99) 评论(0) 推荐(0)
摘要: 字符串操作: gets函数: gets(str); puts函数: puts(str); strcat函数 字符串连接函数 char str1[30] = {"apple"}; char str2[30] = {"app"}; printf("%s",strcat(str1,str2));输出: a 阅读全文
posted @ 2021-01-19 14:27 荣荣荣荣荣荣 阅读(58) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 下一页