为什么全部WA,自己在CodeBlocks上试了看不出问题

P5730 【深基5.例10】显示屏

sunshijie20050405 @ 2024-07-21 12:47:22

#include<stdio.h>
/*
XXX...X.XXX.XXX.X.X.XXX.XXX.XXX.XXX.XXX
X.X...X...X...X.X.X.X...X.....X.X.X.X.X
X.X...X.XXX.XXX.XXX.XXX.XXX...X.XXX.XXX
X.X...X.X.....X...X...X.X.X...X.X.X...X
XXX...X.XXX.XXX...X.XXX.XXX...X.XXX.XXX*/

int main(){
  int n;
  scanf("%d",&n);
  getchar();
  int a[101];
  for(int i=1;i<=n;i++){
    a[i]=getchar()-48;
  }
  //1//
  for(int i=1;i<=n;i++){
    if(a[i]==0){
        printf("XXX");
    }
    if(a[i]==1){
        printf("..X");
    }
    if(a[i]==2){
        printf("XXX");
    }
    if(a[i]==3){
        printf("XXX");
    }
    if(a[i]==4){
        printf("X.X");
    }
    if(a[i]==5){
        printf("XXX");
    }
    if(a[i]==6){
        printf("XXX");
    }
    if(a[i]==7){
        printf("XXX");
    }
    if(a[i]==8){
        printf("XXX");
    }
    if(a[i]==9){
        printf("XXX");
    }
    if(i!=n){
        printf(".");
    }
  }
  printf("\n");
  //2//
  for(int i=1;i<=n;i++){
    if(a[i]==0){
        printf("X.X");
    }
    if(a[i]==1){
        printf("..X");
    }
    if(a[i]==2){
        printf("..X");
    }
    if(a[i]==3){
        printf("..X");
    }
    if(a[i]==4){
        printf("X.X");
    }
    if(a[i]==5){
        printf("X..");
    }
    if(a[i]==6){
        printf("X..");
    }
    if(a[i]==7){
        printf("..X");
    }
    if(a[i]==8){
        printf("X.X");
    }
    if(a[i]==9){
        printf("X.X");
    }
    if(i!=n){
        printf(".");
    }
  }
  printf("\n");
  //3//
  for(int i=1;i<=n;i++){
    if(a[i]==0){
        printf("X.X");
    }
    if(a[i]==1){
        printf("..X");
    }
    if(a[i]==2){
        printf("XXX");
    }
    if(a[i]==3){
        printf("XXX");
    }
    if(a[i]==4){
        printf("XXX");
    }
    if(a[i]==5){
        printf("XXX");
    }
    if(a[i]==6){
        printf("XXX");
    }
    if(a[i]==7){
        printf("..X");
    }
    if(a[i]==8){
        printf("XXX");
    }
    if(a[i]==9){
        printf("XXX");
    }
    if(i!=n){
        printf(".");
    }
  }
  printf("\n");
  //4//
  for(int i=1;i<=n;i++){
    if(a[i]==0){
        printf("X.X");
    }
    if(a[i]==1){
        printf("..X");
    }
    if(a[i]==2){
        printf("X..");
    }
    if(a[i]==3){
        printf("..X");
    }
    if(a[i]==4){
        printf("..X");
    }
    if(a[i]==5){
        printf("..X");
    }
    if(a[i]==6){
        printf("X.X");
    }
    if(a[i]==7){
        printf("..X");
    }
    if(a[i]==8){
        printf("X.X");
    }
    if(a[i]==9){
        printf("..X");
    }
    if(i!=n){
        printf(".");
    }
  }
  printf("\n");
  //5//
  for(int i=1;i<=n;i++){
    if(a[i]==0){
        printf("XXX");
    }
    if(a[i]==1){
        printf("..X");
    }
    if(a[i]==2){
        printf("XXX");
    }
    if(a[i]==3){
        printf("XXX");
    }
    if(a[i]==4){
        printf("..X");
    }
    if(a[i]==5){
        printf("XXX");
    }
    if(a[i]==6){
        printf("XXX");
    }
    if(a[i]==7){
        printf("..X");
    }
    if(a[i]==8){
        printf("XXX");
    }
    if(a[i]==9){
        printf("XXX");
    }
    if(i!=n){
        printf(".");
    }
  }
  return 0;
}

by ab777777 @ 2024-07-21 13:18:58

这么抽象?


by sulingfeng @ 2024-07-21 13:36:00

本蒟蒻暂时看不出问题,看了一下你第一个测试点没问题呀


by sulingfeng @ 2024-07-21 13:37:13

//答案
..X...X.X.X.XXX...X.X.X
..X...X.X.X.X.....X.X.X
..X...X.XXX.XXX...X.XXX
..X...X...X...X...X...X
..X...X...X.XXX...X...X

//你的输出
..X...X.X.X.XXX...X.X.X
..X...X.X.X.X.....X.X.X
..X...X.XXX.XXX...X.XXX
..X...X...X...X...X...X
..X...X...X.XXX...X...X

by sulingfeng @ 2024-07-21 13:37:45

输入:

6

114514


|