预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共23页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

文档鉴赏题1:出现次数最多的数#include<stdio.h>intmain(){inti,j,n,s;intt=1;inta[10001]={0};scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&s);//下标为输入值,每个数组值为输入频数a[s]++;if(a[s]>a[t])t=s;if(a[s]==a[t])t=(s<t?s:t);}printf("%d",t);return0;}题2:ISBN号码#include<stdio.h>intmain(){intsum=0;chara[13]={'\0'};gets(a);sum=(a[0]-'0')*1+(a[2]-'0')*2+(a[3]-'0')*3+(a[4]-'0')*4+(a[6]-'0')*5+(a[7]-'0')*6+(a[8]-'0')*7+(a[9]-'0')*8+(a[10]-'0')*9;if((sum%11==a[12]-'0')||(sum%11==10&&a[12]=='X'))//注意正确情况几种类型{printf("Right");}else{if(sum%11==10)a[12]='X';elsea[12]=sum%11+'0';puts(a);}文档鉴赏return0;}题3:相反数#include<stdio.h>intmain(){inti,j,n,t=0;inta[501];scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);}for(i=0;i<n-1;i++){for(j=i+1;j<n;j++){if(a[i]+a[j]==0)t++;}}printf("%d",t);return0;}题4:窗口#include<stdio.h>typedefstructwindow1{intx1,x2,y1,y2,order;}window;voidInputwindow(windowws[],intn){inti;for(i=1;i<=n;i++){scanf("%d%d%d%d",&ws[n-i].x1,&ws[n-i].y1,&ws[n-i].x2,&ws[n-i].y2);ws[n-i].order=i;}}intgetpos(windowws[],intn,intx,inty){inti;文档鉴赏for(i=0;i<n;i++){if(x>=ws[i].x1&&x<=ws[i].x2&&y>=ws[i].y1&&y<=ws[i].y2){returni;}}return-1;}voidmovewindow(windowws[],intn,intpos){windoww=ws[pos];inti;for(i=pos-1;i>=0;i--){ws[i+1]=ws[i];}ws[0]=w;}intmain(){inti,n,m,x,y,pos;scanf("%d%d",&n,&m);windowws[n];Inputwindow(ws,n);for(i=0;i<m;i++){scanf("%d%d",&x,&y);pos=getpos(ws,n,x,y);if(pos==-1){printf("IGNORED\n");}else{printf("%d\n",ws[pos].order);movewindow(ws,n,pos);}}return0;}题5:相邻数对#include<stdio.h>#include<math.h>文档鉴赏intmain(){inti,j,n,t=0;inta[1001];scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);}for(i=0;i<n-1;i++){for(j=i+1;j<n;j++){if(abs(a[i]-a[j])==1)t++;}}printf("%d",t);return0;}题6:画图#include<stdio.h>intmain(){inti,j,n,k,t=0;inta[101][4];scanf("%d",&n);for(i=0;i<n;i++){scanf("%d%d%d%d",&a[i][0],&a[i][1],&a[i][2],&a[i][3]);}for(i=0;i<101;i++){for(j=0;j<101;j++){for(k=0;k<n;k++){if(j>=a[k][0]&&j<a[k][2]&&i>=a[k][1]&&i<a[k][3])break;}if(k<n)t++;}文档鉴赏}printf("%d",t);return0;}题7:门禁系统#include<stdio.h>intmain(){inti,n,s=