//// Created by 22385 on 2022/1/18.//// A1031 Hello World for U#include<stdio.h>#include<string.h>intmain(){char s[100];scanf("%s",s);int len=strlen(s);int a=1,b=len+2-2*a;while(b>=a){
a++;
b=len+2-2*a;}
a--;
b+=2;int i;for(i=0;i<a-1;i++){printf("%c",s[i]);for(int j=0;j<b-2;j++){printf(" ");}printf("%c\n",s[len-1-i]);}for(int j=0;j<b;j++){printf("%c",s[j+i]);}return0;}
B1027 打印沙漏 (20 分)
//// Created by 22385 on 2022/1/18.//// B1027 打印沙漏 (20 分)// 我不理解!!!!#include<stdio.h>intmain(){int n;char mark;scanf("%d %c",&n,&mark);int count=0,i=1;while((2*i*i-1)<=n){
i++;}
i--;//倒三角形i行//打印上半个三角形for(int j=i;j>1;j--){for(int k=0;k<i-j;k++){printf(" ");}for(int k=0;k<2*j-1;k++){printf("*");}printf("\n");}//打印下半个三角形for(int j=0;j<i;j++){//少一行for(int k=i-j-1;k>0;k--){printf(" ");}for(int k=0;k<2*j+1;k++){printf("*");}printf("\n");}printf("%d",n+1-2*i*i);return0;}
B1031
//// Created by 22385 on 2022/1/18.//#include<stdio.h>chartest(int z);intmain(){int n;int weight[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};scanf("%d",&n);char id[20];int flag=0;for(int i=0;i<n;i++){int sum=0,z;char m;scanf("%s",id);for(int j=0;j<17;j++){
sum+=(id[j]-'0')*weight[j];}
z=sum%11;if(id[17]!=test(z)){
flag=1;printf("%s\n",id);}}if(!flag){printf("All passed");}return0;}chartest(int z){switch(z){case0:return'0'+1;break;case1:return'0';break;case2:return'X';//大写Xbreak;default:return'0'+12-z;}}