版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1:2:3#include<stdio.h>#include<math.h>intmain(){inti=0,j=0,k=0,a=0,b=0,c=0,l=0,m=0,n=0,d=0,p=0,q=0;for(i=1;i<=3;i++){for(j=1;j<=9;j++){if(i!=j){for(k=1;k<=9;k++){if(k!=j&&i!=k){a=i*100+j*10+k;b=a*2;c=a*3;l=b%10,d=c%10;m=(b%100)/10,p=(c%100)/10;n=b/100,q=c/100;if(l!=0&&m!=0&&n!=0&&d!=0&&p!=0&&q!=0)if(i!=l&&i!=m&&i!=n&&j!=l&&j!=m&&j!=n&&k!=l&&k!=m&&k!=n)if(i!=d&&i!=p&&i!=q&&j!=d&&j!=p&&j!=q&&k!=d&&k!=p&&k!=q)if(l!=d&&l!=p&&l!=q&&m!=d&&m!=p&&m!=q&&n!=d&&n!=p&&n!=q)printf("%d%d%d\n",a,b,c);}}}}}return0;}8#include"stdio.h"intmain(){inta,b[10],m=0,n=0,p;inti,j,k;scanf("%d",&a);for(i=1;i<=a;i++){m=0;n=0;p=i;for(j=0;p!=0;j++){b[j]=p%10;p=p/10;}for(k=0;k<j;k++){m=m+b[k];if(b[k]==8){n=1;}}if(m%8==0){printf("%d",i);continue;}if(i%8==0){printf("%d",i);continue;}if(n==1){printf("%d",i);continue;}}return0;}8的次數(shù)A*B#include<stdio.h>#include<string.h>#include<stdlib.h>voidcheng(chara[],charb[]){inti,j,ca,cb,*s;ca=strlen(a);cb=strlen(b);s=(int*)malloc(sizeof(int)*(ca+cb));for(i=0;i<ca+cb;i++)s[i]=0;for(i=0;i<ca;i++)for(j=0;j<cb;j++)s[i+j+1]+=(a[i]-'0')*(b[j]-'0');for(i=ca+cb-1;i>=0;i--)if(s[i]>=10){s[i-1]+=s[i]/10;s[i]%=10;}i=0;while(s[i]==0)i++;for(;i<ca+cb;i++)printf("%d",s[i]);printf("\n");free(s);}intmain(){chara[100],b[100];gets(a),gets(b);if(a[0]=='-'&&b[0]!='-'){printf("-");cheng(&a[1],b);}elseif(a[0]=='-'&&b[0]=='-'){cheng(&a[1],&b[1]);}elseif(a[0]!='-'&&b[0]=='-'){printf("-");cheng(a,&b[1]);}elsecheng(a,b);return0;}N邊形面積#include<stdio.h>#include<math.h>#definePI3.1415926intmain(){doubles,a;intn;scanf("%d%lf",&n,&a);s=a*a*n/(2*2*tan(PI/n));printf("%.2lf\n",s);return0;}參與競(jìng)賽#include<stdio.h>intmain(){inta,b,c,d,e;for(a=0;a<2;a++)for(b=0;b<2;b++)for(c=0;c<2;c++)for(d=0;d<2;d++)for(e=0;e<2;e++)if(((a==1&&b==1)||(a==0&&b==0))&&((b==0&&c==1)||(b==1&&c==0))&&((c==1&&d==1)||(c==0&&d==0))&&(!(d==0&&e==0))&&((e==1&&a==1&&d==1)||(e==0))){if(a==1){printf("A");}if(b==1){printf("B");}if(c==1){printf("C");}if(d==1){printf("D");}if(e==1){printf("E");}}return0;}草坪噴水插入排序#include<stdio.h>voidsort(inta[],intn){?inti;?intk; intt;?for(i=1;i<n;i++) {??t=a[i]; k=i-1;??while(t<a[k]){? a[k+1]=a[k]; ??k--; ??if(k==-1)break;??}??a[k+1]=t; }}intmain(){ intn; inta[100]; inti;?scanf("%d",&n); for(i=0;i<n;i++)? scanf("%d",&a[i]);?sort(a,n);?printf("\n");?for(i=0;i<n;i++)? if(i==n-1)? printf("%d\n",a[i]);??elseprintf("%d",a[i]);return0;}查找車牌號(hào)#include<stdio.h>#include<math.h>intmain(){ inti,j,n; for(i=1;i<=9;i++){??for(j=0;j<=9;j++){ ? for(n=33;n<=100;n++){????if((n*n)==(i*1100+j*11))printf("%d",i*1100+j*11);?? }??}?} return0;}成績(jī)轉(zhuǎn)化乘完倒序尺子刻度大數(shù)除法大數(shù)減法#include<stdio.h>#include<string.h>#definemax(a,b)a>b?a:b#definemin(a,b)a>b?b:aintsum[101];voidjia(chara[],charb[]){intflag=0,i,len1,len2,lenmax,lenmin;len1=strlen(a),len2=strlen(b);lenmax=max(len1,len2),lenmin=min(len1,len2);for(i=1;i<=lenmax;i++){if(i<=lenmin){sum[lenmax-i]=a[len1-i]+b[len2-i]-'0'-'0'+flag;if(sum[lenmax-i]>=10){sum[lenmax-i]=sum[lenmax-i]-10;flag=1;}elseflag=0;}else{if(len1>len2){sum[lenmax-i]=a[len1-i]-'0'+flag;if(sum[lenmax-i]>=10){sum[lenmax-i]=sum[lenmax-i]-10;flag=1;}elseflag=0;}else{sum[lenmax-i]=b[len2-i]-'0'+flag;if(sum[lenmax-i]>=10){sum[lenmax-i]=sum[lenmax-i]-10;flag=1;}elseflag=0;}}}if(flag==1)printf("1");for(i=0;i<lenmax;i++)printf("%d",sum[i]);printf("\n");}voidjian(chara[],charb[]){intflag=0,i;intlen1,len2;len1=strlen(a),len2=strlen(b);for(i=1;i<=len1;i++){if(i<=len2){if(a[len1-i]-b[len2-i]-flag>=0){sum[len1-i]=a[len1-i]-b[len2-i]-flag;flag=0;}else{sum[len1-i]=a[len1-i]-b[len2-i]-flag+10;flag=1;}}else{if(a[len1-i]-flag-'0'>=0){sum[len1-i]=a[len1-i]-flag-'0';flag=0;}else{sum[len1-i]=a[len1-i]-flag+10-'0';flag=1;}}}for(i=0;i<len1&&sum[i]==0;i++);for(;i<len1;i++)printf("%d",sum[i]);printf("\n");}voidcompare(chara[],charb[]){intlen1,len2;len1=strlen(a),len2=strlen(b);if(len1>len2||(len1==len2&&strcmp(a,b)>0))jian(a,b);elseif(strcmp(a,b)!=0){printf("-");jian(b,a);}elseprintf("0\n");}intmain(){chara[100],b[100];gets(a);gets(b);if(a[0]=='-'&&b[0]!='-'){printf("-");jia(&a[1],b);}elseif(a[0]=='-'&&b[0]=='-')compare(&b[1],&a[1]);elseif(a[0]!='-'&&b[0]=='-')jia(a,&b[1]);elsecompare(a,b);return0;}大寫變小寫#include<stdio.h>#include<string.h>intmain(){chars[80];intlen,i;gets(s);len=strlen(s);for(i=0;i<len;i++){if(s[i]>='a'&&s[i]<='z')s[i]=s[i]-32; }puts(s);return0;}到底星期幾等比數(shù)列#include<stdio.h>#include<stdlib.h>intmain(){intm,n,sum;scanf("%d",&m);for(n=1;;n++){sum=(3*n-1)*n/2;if(sum>m)break;}printf("%d",n);return0;}分?jǐn)?shù)#include<stdio.h>intmain(){ intk,x=1,y=1;?float(yī)a,b; scanf("%d",&k);?for(;y<=5000;y++){ ?for(x=y;x<=5000;x++){ ?a=1.0/k;b=1.0/x+1.0/y;??if(a==b)printf("1/%d=1/%d+1/%d\n",k,x,y);?}?}?return0;}韓信點(diǎn)兵#include<stdio.h>intmain(){?intn,i; for(i=0;;i++){??if(i%5==2&&i%6==3&&i%7==4&&i%11==5){printf("%d",i);break;}?}?return0;}回文字符串#include<stdio.h>#include<string.h>#include<ctype.h>#defineMAXN5000+10charbuf[MAXN],s[MAXN];intp[MAXN];intmain(){intn,m=0,max=0,x,y;inti,j;fgets(buf,sizeof(s),stdin);n=strlen(buf);for(i=0;i<n;i++){if(isalpha(buf[i])){p[m]=i;s[m++]=toupper(buf[i]);}}for(i=0;i<m;i++){for(j=0;i-j>=0&&i+j<m;j++){if(s[i-j]!=s[i+j])break;if(j*2+1>max){max=j*2+1;x=p[i-j];y=p[i+j];}}for(j=0;i-j>=0&&i+j+1<m;j++){if(s[i-j]!=s[i+j+1])break;if(j*2+2>max){max=j*2+2;x=p[i-j];y=p[i+j+1];}}}for(i=x;i<=y;i++)printf("%c",buf[i]);printf("\n");return0;}#include<iostream>usingnamespacestd;intmain(){charA[5000],B[5000];inta=0,b,c,d,e,f,n=0,m,p,q,C[5000];while((A[a]=cin.get())!='\n')a++;for(b=0,c=0;b<=a-1;b++){if((A[b]>=65&&A[b]<=90)||(A[b]>=97&&A[b]<=122)){B[c]=A[b],C[c]=b;if(B[c]>=97&&B[c]<=122)B[c]=B[c]-32;c++;}}B[c]=32;for(d=0;d<=c-2;d++){if(B[d]==B[d+1])e=d,f=d+1,a=1;elseif(B[d]==B[d+2])e=d,f=d+2,a=1;elsecontinue;while(e-1>=0&&f+1<=c&&B[e-1]==B[f+1])e--,f++;m=f-e;if(m>n)n=m,p=e,q=f;}for(a=C[p];a<=C[q];a++)cout<<A[a];cout<<endl;}雞的體重計(jì)算數(shù)據(jù)整數(shù)部分加密#include<stdio.h>#include<string.h>intmain(){?FILE*pi;?pi=fopen("in.dat","w");?charA[1000],B[1000]; inti,n;?gets(A); n=strlen(A); for(i=0;i<n;i++){? fprintf(pi,"%c",A[i]);? if('A'<=A[i]<'Z'||'a'<=A[i]<'z') ??B[i]=A[i]+1;??if(A[i]=='Z'||A[i]=='z') ? B[i]=A[i]-25;? } for(i=0;i<n;i++) ?printf("%c",B[i]); ?fclose(pi); return0;}階乘#include<stdio.h>intmain(){intn;inti=2;intj=1;scanf("%d",&n);while(1){j=j(luò)*i;if(j>n)break;i++;}printf("%d\n",i-1);return0;}卡片恐怖水母#include<stdio.h>voidpaixu(intA[],intm){inti=1,n=0,j=0;for(;j<m;j++){for(i=j+1;i<m;i++){if(A[i]<A[j]){n=A[j];A[j]=A[i];A[i]=n;}}}}intmain(){intn=0,m=0,A[100]={0},B[100]={0},i=0,j=0,k=0;scanf("%d%d",&n,&m);for(i=0;i<n;i++){scanf("%d",&A[i]);}for(i=0;i<m;i++){scanf("%d",&B[i]);}if(m<n){printf("NULL\n");}else{paixu(A,n);paixu(B,m);for(i=0;i<m;i++){if(A[0]<=B[i]){if(m-i>=n){for(k=0;k<n;k++){j+=B[i+k];}printf("%d\n",j);}else{printf("NULL\n");}break;}}}return0;}快速排序#include<stdio.h>voidQuickSort(intA[],intn,intL,intR){?inti,j,t;?if(L<R){??i=L;j=R+1;??while(1){???while(i+1<n&&A[++i]<A[L]);???while(j-1>-1&&A[--j]>A[L]);? if(i>=j)break; ?t=A[i];A[i]=A[j];A[j]=t; ?}??t=A[L],A[L]=A[j],A[j]=t;? QuickSort(A,n,L,j-1);??QuickSort(A,n,j+1,R); }?}intmain(){?intA[1000],n,i,j,p;?scanf("%d",&n);?if(n>=1000){printf("Overflow!!!");return0;}?//輸入要排序的元素的數(shù)目,若大于1000則結(jié)束程序輸出“Overflow??!!”?for(i=0;i<n;i++) ?scanf("%d",&A[i]);//輸入元素 QuickSort(A,n,0,n-1);?for(i=n-1;i>=0;i--)??printf("%d",A[i]);//輸出排序好的結(jié)果return0;}兩人三足#include<stdio.h>intmain(){ intn,a[50],i,j,t,sum=0;?scanf("%d\n",&n);?for(i=0;i<n;i++)scanf("%d",&a[i]);?for(i=0;i<n;i++){??for(j=0;j<n-i-1;j++){???if(a[j]<a[j+1])t=a[j],a[j]=a[j+1],a[j+1]=t; }?}?for(i=0;i<n;i+=2)sum+=a[i];?printf("%d",sum);?return0;}逆序輸出偶數(shù)和#include<stdio.h>#include<stdlib.h>intmain(){intn,i,sum=0;scanf("%d",&n);inta[n];for(i=0;i<n;i++){scanf("%d",&a[i]);}for(i=0;i<n;i++){if(i%2==0)sum=sum+a[i];}?printf("%d",sum);return0;}三角形面積士兵移動(dòng)輸出位數(shù)#include<stdio.h>intmain(){inti,n;scanf("%d",&n);for(i=1;;i++){if(n/10==0)break;elsen=n/10;}printf("%d",i);}數(shù)列#include<stdio.h>intmain(){?intA[10],B[5],i;doubleC[5];?for(i=0;i<5;i++) scanf("%d",&A[i]);?for(i=0;i<4;i++){? ?B[i]=A[i+1]-A[i];C[i]=(double)A[i+1]/A[i]; }?if(B[0]==B[1]&&B[1]==B[2]&&B[2]==B[3]){?? ?for(i=5;i<10;i++)?A[i]=A[i-1]+B[0],printf("%d",A[i]);return0;??}if(C[0]==C[1]&&C[1]==C[2]&&C[2]==C[3]){????for(i=5;i<10;i++)? ?A[i]=A[i-1]*C[0],printf("%d",A[i]); ?return0;??} ??if((A[0]+A[1]==A[2])&&(A[1]+A[2]==A[3])&&(A[2]+A[3]==A[4])){??? for(i=5;i<10;i++)? A[i]=A[i-1]+A[i-2], ???printf("%d",A[i]);? ?return0;? ?}?printf("NULL"); return0;}數(shù)字加密數(shù)組元素和水仙花數(shù)提取字符串#include<stdio.h>#include<string.h>intmain(){?charA[100];?charl[100]; gets(A);?intm,n,i,j;?scanf("%d",&m); n=strlen(A);?for(i=m;i<n;i++)?{??l[i]=A[i];?}?for(j=m;j<n;j++) { printf("%c",l[j]);?}?printf("\n"); return0;}添加行號(hào)#include<stdio.h>#include<string.h>intmain(){?charA[3][100],B[3][100];?inti; FILE*fp; fp=fopen("b.c","w");?for(i=0;i<3;i++) ?gets(A[i]);?fprintf(fp,"0001"); fputs(A[0],fp);?fprintf(fp,"\n""0002"); fputs(A[1],fp);?fprintf(fp,"\n""0003");?fputs(A[2],fp);?fprintf(fp,"\n");?fclose(fp);?printf("0001");puts(A[0]);?printf("0002");puts(A[1]);?printf("0003");puts(A[2]);?return0;}舞伴配對(duì)相乘后位數(shù)相加#include<stdio.h>intmain(){intk;longa,b;scanf("%ld%ld",&a,&b);if(a==0||b==0)printf("0\n");else{k=(a%9)*(b%9)%9;if(k==0)printf("9\n");elseprintf("%d\n",k);}return0;}#include<iostream>usingnamespacestd;intmain(){charA[13],B[13];inta=0,b=0,c,d,e,f,m=0,X[13],Y[13];for(c=0;c<=12;c++)X[c]=0,Y[c]=0;while((A[a]=cin.get())!=32)a++;while((B[b]=cin.get())!='\n')b++;for(c=0,a--;a>=0;a--,c++)X[c]=A[a]-48;for(d=0,b--;b>=0;b--,d++)Y[d]=B[b]-48;for(e=0;e<=c-1;e++)for(f=0;f<=d-1;f++)m=m+X[e]*Y[f];while(m>10){a=m%10,m=(m-a)/10+a;}cout<<m<<endl;return0;}銷售記錄#include<stdio.h>#include<string.h>typedefstructtagME{chara0[5];chara1[11];chara2[20];inta3;inta4;}tag;intmain(){taga[100],b[100];intn,i,j=1,k=0;FILE*fp;scanf("%d",&n);for(i=0;i<=n-1;i++){scanf("%s%s%s%d%d",a[i].a0,a[i].a1,a[i].a2,&a[i].a3,&a[i].a4);}fp=fopen("out.dat","w");if(fp?。剑蜺LL){for(j=0;j<=n-1;j++){fscanf(fp,"%s%s%s%d%d",a[j].a0,a[j].a1,a[j].a(chǎn)2,&a[j].a3,&a[j].a4);}for(i=0;i<=n-2;i++){ if(a[i].a4>=a[i+1].a(chǎn)4)b[0]=a[i],a[i]=a[i+1],a[i+1]=b[0];}printf("%s%s%s%d%d",a[i].a(chǎn)0,a[i].a1,a[i].a2,a[i].a3,a[i].a4);fclose(fp);}return0;}星期幾星座#include<stdio.h>intmain(){?inta,b; scanf("%d%d",&a,&b); switch(a){??case1:if(b<=19)printf("Capricorn");??elseprintf("Aquarius");break;?case2:if(b<=18)printf("Aquarius");? elseprintf("Pisces");break;??case3:if(b<=20)printf("Pisces"); ?elseprintf("Aries");break;? case4:if(b<=20)printf("Aries");??elseprintf("Taurus");break;??case5:if(b<=20)printf("Taurus");??elseprintf("Gemini");break;??case6:if(b<=21)printf("Gemini");??elseprintf("Cancer");break;? case7:if(b<=22)printf("Cancer");??elseprintf("Leo");break;? case8:if(b<=22)printf("Leo");??elseprintf("Virgo");break; ?case9:if(b<=22)printf("Virgo"); ?elseprintf("Libra");break;??case10:if(b<=22)printf("Libra");? elseprintf("Scorpio");break; case11:if(b<=21)printf("Scorpio"); elseprintf("Sagittarius");break;??case12:if(b<=21)printf("Sagittarius");??elseprintf("Capricorn");break;?}?return0;}幸運(yùn)數(shù)學(xué)號(hào)循環(huán)移位#include<stdio.h>intmove(intvalue,intn){if(n<0){n=-n;value=(value<<n|value>>(32-n));}elsevalue=(value>>n|value<<(32-n));return(value);}intmain(){intx,y;scanf("%d%d",&x,&y);printf("%d\n",move(x,y));return0;}月份天數(shù)#include<stdio.h>intmain(){inty,m,d;intA[1
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度玻璃隔斷行業(yè)安全風(fēng)險(xiǎn)評(píng)估與控制合同3篇
- 二零二五版美容美發(fā)產(chǎn)品跨境電商銷售合作協(xié)議4篇
- 玻璃幕墻維修施工方案
- 二零二五版美容院供應(yīng)鏈管理及股權(quán)投資協(xié)議4篇
- 環(huán)氧砂漿施工方案
- 2025年P(guān)DA市場(chǎng)拓展專用采購(gòu)合同3篇
- 2025年度智能家居公司成立合作協(xié)議書正式版4篇
- 2025年度新型農(nóng)業(yè)貸款合同標(biāo)的特征分析3篇
- 2024版鋁單板采購(gòu)合同
- 會(huì)展搭建施工方案
- 地測(cè)防治水技能競(jìng)賽理論考試題庫(kù)(含答案)
- 以諾書-中英對(duì)照
- 三角形與全等三角形復(fù)習(xí)教案 人教版
- 《朝天子·詠喇叭-王磐》核心素養(yǎng)目標(biāo)教學(xué)設(shè)計(jì)、教材分析與教學(xué)反思-2023-2024學(xué)年初中語(yǔ)文統(tǒng)編版
- 成長(zhǎng)小說(shuō)智慧樹知到期末考試答案2024年
- 紅色革命故事《王二小的故事》
- 海洋工程用高性能建筑鋼材的研發(fā)
- 英語(yǔ)48個(gè)國(guó)際音標(biāo)課件(單詞帶聲、附有聲國(guó)際音標(biāo)圖)
- GB/T 6892-2023一般工業(yè)用鋁及鋁合金擠壓型材
- 冷庫(kù)安全管理制度
- 2023同等學(xué)力申碩統(tǒng)考英語(yǔ)考試真題
評(píng)論
0/150
提交評(píng)論