随笔分类 -  上机

摘要:从文件中读取一行字符,对字符按逗号分割成单词,并计算每个单词出现次数 #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct word{ char str[32]; int cot; }word; void mai 阅读全文
posted @ 2023-02-19 18:42 Maxwell· 阅读(36) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> char a[1024][1024]; int count=0; void split(char s[],char del){ int len=strlen(s); int i=0,k=0 阅读全文
posted @ 2021-03-12 20:16 Maxwell· 阅读(241) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <string.h> #include <iostream> #include <math.h> #include <vector> using namespace std; const int inf=999999;//0x7fffff v 阅读全文
posted @ 2021-03-12 10:34 Maxwell· 阅读(218) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; int main(){ int n; cin>>n; for(int i=2;i<=n;i++){ while(n!=0){ if(n%i== 阅读全文
posted @ 2021-01-12 21:04 Maxwell· 阅读(67) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; int greatest_common_divisor1(int a,int b){ //辗转相减法 while(a!=b){ if(a>b) 阅读全文
posted @ 2021-01-12 20:28 Maxwell· 阅读(85) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; void k_system(int n,int k){ //n:十进制数,k为进制 int t=n; int m=0; int a[10]; 阅读全文
posted @ 2021-01-10 22:33 Maxwell· 阅读(423) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; bool hui_number(int n){ int t=n; int k=0; int a[10]; while(t>0){ //提前数的 阅读全文
posted @ 2021-01-10 22:23 Maxwell· 阅读(58) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; bool Narcissistic_number(int n){ int t=n; int a[3]; int k=0; while(t>0) 阅读全文
posted @ 2021-01-10 21:54 Maxwell· 阅读(45) 评论(0) 推荐(0)
摘要:用一维数组或二维数组打印杨辉三角 #include <stdlib.h> #include <math.h> #include <iostream> using namespace std; int a[15][15]; int aa[1024]; void yang_2D(){//二维数组打印杨辉 阅读全文
posted @ 2021-01-10 21:04 Maxwell· 阅读(98) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <math.h> #include <iostream> using namespace std; bool prime(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0) return false; } 阅读全文
posted @ 2021-01-10 17:31 Maxwell· 阅读(39) 评论(0) 推荐(0)