💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ###(1)分类 ``` #include<stdio.h> #include<string.h> int main(void){ int num,snum,N; num=0; snum=0; char s[100]; char c[100]; char str[100]; scanf("%d",&N); scanf("%s",s); for(int i=0;i<N;i++) { if(s[i]<='9'&&s[i]>='0') { c[num]=s[i]; num++; } else if(s[i]<='z'&&s[i]>='a'||s[i]<='Z'&&s[i]>='A') { str[snum]=s[i]; snum++; } } for(int k=0;k<=num;k++) { printf("%c",c[k]); } printf("\n"); for(int j=0;j<=snum;j++) { printf("%c",str[j]); } printf("\n"); return 0; } ``` ### (2)找出矩阵中的字符 ``` ``` ### (3)矩阵翻转 ``` #include<stdio.h> int main(void){ //shuru int a[100][100]; int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); //jisuan for(i=0;i<n;i++){ for(j=0;j<n;j++) printf("%d ",a[j][i]); printf("\n"); } //shuchu return 0; } ``` ### (4)求和 ``` #include <stdio.h> int main() { int num = 0; int sum = 0; char ch; while((ch = getchar()) != '\n') { if(ch >= '0' && ch <= '9') num = 10 * num + ch - '0'; if(ch == '.') { sum += num; num = 0; } } printf("%d\n",sum + num); return 0; } ```