//数组查找及替换 #include<stdio.h> #include<stdlib.h> int comp(const void *a,const void *b){ return *(int*)a - *(int*)b; } int main(){ int N,b; int a[101]; scanf("%d%d",&N,&b); for(int i=0;i<N;i++) scanf("%d",&a[i]); qsort(a,N,sizeof(int),comp); for(int i=0;i<N;i++){ if(a[i]%b == 0) continue; else{ if(a[i]>=‘A‘ && a[i] <=‘Z‘) printf("%c ",a[i]); else printf("%d ",a[i]); } } return 0; }
原文地址:https://www.cnblogs.com/Hqx-curiosity/p/12244635.html
时间: 2024-11-08 18:57:03