您好,欢迎访问三七文档
/*********************************************************//*---------------Í·ÎļþÒýÓÃ-----------------------------*/#includestdio.h#includestdlib.h#includemath.h#includestring.h/*----------------Ô¤´¦Àí¿é-----------------------*//*---------------º¯Êý¶¨Òå---------------------------*//*****************Ö÷º¯Êý***************************//*Test_ONE_*///Êä³öÈý¸öÕûÊýÖ®ºÍ/***************************************************************************intmain(){inta,b,c;scanf(%d,&a);scanf(%d,&b);scanf(%d,&c);printf(%d\n,a+b+c);return0;}/**************************************************//*Test_TWO_*///ÅжÏÊÇ·ñÕû³ý/***************************************************************************intmain(){intM,N;scanf(%d,&M);scanf(%d,&N);if(M%N==0)printf(%s\n,YES);elseprintf(%s\n,NO);return0;}/**************************************************//*Test_THREE_*///ÅжÏÖÊÊý/**************************************************************************intmain(){inta,i,j=0;scanf(%d,&a);if(2==a){printf(%s\n,YES);}else{for(i=2;i(a-1);i++){if(a%i==0){j=1;break;}}if(j==0)printf(%s\n,YES);elseprintf(%s\n,NO);}return0;}/**************************************************//*Test_FOUR_*///¼òµ¥ì³²¨ÄÇÆõÊýÁÐ/***************************************************************************intmain(){intRowNumber;intNowValue=0;intPreValue=1;intPrePreValue=0;inti;scanf(%d,&RowNumber);if(RowNumber==1){printf(1\n);}elseif(!RowNumber){printf(0\n);}elseif(RowNumber=2){for(i=1;iRowNumber;i++){NowValue=PreValue+PrePreValue;PrePreValue=PreValue;PreValue=NowValue;}printf(%d\n,NowValue);}return0;}/**************************************************//*Test_FIVE_*///¾ØÕó·×ª/***************************************************************************intmain(){intM;//ÐÐÊýintN;//ÁÐÊýintT;//0ʱ×óÓҷת£»1ʱÉÏÏ·ת£»intRow;intLine;intarray[200][200];intSteadArray[200][200];int*LineValue;scanf(%d%d%d,&M,&N,&T);/*array=(int**)malloc(M*sizeof(int*));//µÚһά£¨ÐУ©µÄ³¤¶È£»for(Line=0;LineN;Line++){array[Line]=(int*)malloc(N*sizeof(int));//µÚ¶þά£¨ÁУ©µÄ³¤¶È£»}for(Row=0;RowM;Row++){for(Line=0;LineN;Line++){scanf(%d,&array[Row][Line]);}//printf(\n);}printf(\n);for(Row=0;RowM;Row++){for(Line=0;LineN;Line++){printf(%d,array[Row][Line]);}printf(\n);}for(Line=0;LineN;Line++)//ÊͷŵڶþάÁÐÖ¸Õë{free(array[Line]);}free(array);//ÊͷŵÚһάÐÐÖ¸Õë//printf(%d\n,RowValue);*//*for(Row=0;RowM;Row++){for(Line=0;LineN;Line++){scanf(%d,&array[Row][Line]);}}if(1==T){intTemp;for(Row=0;Row(M/2);Row++){for(Line=0;LineN;Line++){Temp=array[Row][Line];array[Row][Line]=array[M-1-Row][Line];array[M-1-Row][Line]=Temp;}}for(Row=0;RowM;Row++){for(Line=0;LineN;Line++){printf(%d,array[Row][Line]);}printf(\n);}}elseif(0==T){intTemp;for(Row=0;RowM;Row++){for(Line=0;Line(N/2);Line++){Temp=array[Row][Line];array[Row][Line]=array[Row][N-1-Line];array[Row][N-1-Line]=Temp;}}for(Row=0;RowM;Row++){for(Line=0;LineN;Line++){printf(%d,array[Row][Line]);}printf(\n);}}return0;}/**************************************************//*Test_SIX_*///ÄàËÜ¿Í/***************************************************************************typedefstructClassSauces{intVolume;charName[9];}People;intmain(){PeopleStudent[8];intStuNumber;charMaxVlmName[9];charMinVlmName[9];inti;intTempMax;intTempMin;intLongth;intWidth;intHeight;while(scanf(%d,&StuNumber),StuNumber!=-1){for(i=0;iStuNumber;i++){scanf(%d%d%d%s,&Longth,&Width,&Height,Student[i].Name);Student[i].Volume=Longth*Width*Height;}TempMax=Student[0].Volume;strcpy(MaxVlmName,Student[0].Name);strcpy(MinVlmName,Student[0].Name);TempMin=Student[0].Volume;for(i=0;iStuNumber;i++){if(Student[i].VolumeTempMax){TempMax=Student[i].Volume;strcpy(MaxVlmName,Student[i].Name);}if(Student[i].VolumeTempMin){TempMin=Student[i].Volume;strcpy(MinVlmName,Student[i].Name);}}printf(%stookclayfrom%s.\n,MaxVlmName,MinVlmName);}return0;}/**************************************************//*Test_SEVEN_*///Ææ¹ÖµÄÍõ¹ú/***************************************************************************intmain(){chara[100];charb[100];charc[51];chard[51];chararr[100];intNumber;inti;scanf(%s,a);scanf(%s,b);Number=strlen(a);for(i=0;iNumber;i++){if(a[i]==b[i])arr[i]='1';elsearr[i]='0';}arr[Number]='\0';printf(%s\n,arr);return0;}/**************************************************//*Test_EIGHT_*///×Ö·û´®³¤¶È/***************************************************************************intstr_len(char*str);intmain(){charstr[10000];scanf(%s,str);printf(%d\n,str_len(str));return0;}intstr_len(char*str){inti=0;while(str[i]!='\0')i++;returni;}/**************************************************//*Test_NINE_*///ÔªËØÒƳý/***************************************************************************intremoveElement(intA[],intn,intelem);intmain(){intarr[10000];intn;intResult;intelem;inti;scanf(%d,&n);for(i=0;in;i++)scanf(%d,&arr[i]);scanf(%d,&elem);Result=removeElement(arr,n,elem);printf(%d\n,Result);return0;}intremoveElement(intA[],intn,intelem){inti;intarrElem;arrElem=n;for(i=0;in;i++){if(A[i]==elem)arrElem--;}returnarrE
本文标题:计蒜客习题
链接地址:https://www.777doc.com/doc-4393134 .html