随笔分类 -  刷题

摘要:大数据求阶乘,例如求 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 荣荣荣荣荣荣 阅读(103) 评论(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 荣荣荣荣荣荣 阅读(100) 评论(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 荣荣荣荣荣荣 阅读(60) 评论(0) 推荐(0)
摘要:第39阶 台阶 #include <stdio.h> #define m 5//台阶数作为树层数 int count=0;//方案数 int foot=0;//步数 void dfs(int t) { if(t==m){ if(foot%2==0){//走到最后,必须偶数步 count++; pri 阅读全文
posted @ 2020-11-17 17:56 荣荣荣荣荣荣 阅读(71) 评论(0) 推荐(0)