蓝桥杯小菜鸡不想用二维数组试图解题,然后...就出了亿点点小问题
#include<stdio.h>
int main(){
char a[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int n,p;
scanf("%d%d",&n,&p);
for(int i = 0;i < n;i++ ){
int t = i;
for(int j = 0; j < p;j++){
if(t >= 0){
printf("%c",a[t%p]);
t--;
}else{
printf("%c",a[j-i]);
}
}
printf("\n");
}
return 0;
}
只能过7个点
有没有大佬知道什么情况会导致出错呀,球球~~