acm1146Z我自己运行结果正确,为什么提交不成功

buptwaitme2002 buptwaitme2002 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char ch[30][20];
typedef struct display
{int s;
int d;
int data[10];
struct display *next;
}display;
display *read()
{int s,k,i;
display *f,*r,*head;
long int n,j;
r=NULL;
head=r;
k=0;
scanf("%d%ld",&s,&n);
while(!(s==0&&n==0)&&s>=1&&s<=10&&n>=0&&n<=99999999)
{r=(display*)malloc(sizeof(display));
if(k==0)
{head=r;
f=r;
}
else
{f->next=r;
f=r;
}
r->s=s;
r->d=0;
j=n;
while(j!=0)
{r->d++;
j=j/10;
}
for(i=r->d-1;i>=0;i--)
{r->data[i]=n%10;
n=n/10;
}
k++;
scanf("%d%ld",&s,&n);
}
r->next=NULL;
return head;
}
void dispose(int s,int c)
{int row,col;
for(row=0;row<2*s+3;row++)
for(col=0;col<s+2;col++)
ch[row][col]=' ';
switch(c)
{case 0:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
{ch[row][0]='|';
ch[row][s+1]='|';
}
for(row=s+2;row<2*s+2;row++)
{ch[row][0]='|';
ch[row][s+1]='|';
}
break;
case 1:
for(row=1;row<s+1;row++)
ch[row][s+1]='|';

for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
case 2:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
ch[row][s+1]='|';
for(row=s+2;row<2*s+2;row++)
ch[row][0]='|';
break;
case 3:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
ch[row][s+1]='|';
for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
case 4:
for(col=1;col<s+1;col++)
ch[s+1][col]='-';
for(row=1;row<s+1;row++)
{ch[row][s+1]='|';
ch[row][0]='|';
}
for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
case 5:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
ch[row][0]='|';
for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
case 6:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
ch[row][0]='|';
for(row=s+2;row<2*s+2;row++)
{ch[row][s+1]='|';
ch[row][0]='|';
}
break;
case 7:
for(row=1;row<s+1;row++)
ch[row][s+1]='|';
for(col=1;col<s+1;col++)
ch[0][col]='-';
for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
case 8:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
{ch[row][0]='|';
ch[row][s+1]='|';
}
for(row=s+2;row<2*s+2;row++)
{ch[row][0]='|';
ch[row][s+1]='|';
}
break;
case 9:
for(col=1;col<s+1;col++)
{ch[0][col]='-';
ch[s+1][col]='-';
ch[2*s+2][col]='-';
}
for(row=1;row<s+1;row++)
{ch[row][0]='|';
ch[row][s+1]='|';
}
for(row=s+2;row<2*s+2;row++)
ch[row][s+1]='|';
break;
default:break;
}
}
int main()
{display *head,*p;
int k,i,row,col;
head=read();
p=head;
while(p!=NULL)
{k=p->d;
for(row=0;row<2*(p->s)+3;row++)
{for(i=0;i<k;i++)
{ dispose(p->s,p->data[i]);
for(col=0;col<(p->s)+2;col++)
printf("%c",ch[row][col]);
printf(" ");
}
printf("\n");
}
printf("\n\n");
p=p->next;
}
return 0;
}
...全文

相关推荐

ZJU_ACM_All_Anwer 搞编程的都知道的浙江大学A 题库.本书 集了所有经 Z 题解集,集合并附 Mathimaticsumerical algorithms 数值算法

ZJU_Main 主页 下一页 ZJU 题型分类 文演整理版 2008-3-23 数论: 1007 Numerical Summation of a Series 简单题,还是蛮有意思的 1045 HangOver 简单题 1049 I Think I Need a Houseboat 简单题 1028 Flip and Shift 简单题,可以DP/BFS/……,但是实际上有数学方法可直接判断出来 1026 Modular multiplication of polynomials 简单题,有比较简单的好算法 1307 Packets 简单题,不过也蛮经典的…… 1312 Prime Cuts 简单题 1334 Basically Speaking 简单题 1337 Pi 简单题 1342 Word Index 简单题 1349 Four Quarters 简单题 1350 The Drunk Jailer 简单题 1352 Number Base Conversion 简单题 1353 Unimodal Palindromic Decompositions 规模不大,所以是简单题…… 1354 Extended Lights Out 简单题 1362 Game Prediction 简单题 1365 Mileage Bank 简单题 1382 A Simple Task 简单题 1383 Binary Numbers 简单题 1403 Safecracker 简单题 1408 The Fun Number System 简单题 1486 Color the Tree 简单题 1487 Playing Cards 简单题 1489 2^x mod n = 1 简单题,应该有好算法,不过枚举就可以过…… 1503 One Person "The Price is Right" 简单题,POI Eggs的翻版 1512 Water Treatment Plants 简单题,组合计数 1526 Big Number 简单题,不过O(1)和O(n)还是有区别的:) 1529 Enigmatic Travel 简单题,不过个人感觉题目描述很令人费解 1530 Find The Multiple 简单题 1537 Playing with a Calculator 简单题 1577 GCD & LCM 简单题,分区联赛的题…… 1005 Jugs 简单题 1543 Stripies 简单题 1569 Partial Sums 简单题 1062 Trees Made to Order 简单题 1070 Bode Plot 简单题 1073 Round and Round We Go 简单题,142857,我喜欢^_^ 1078 Palindrom Numbers 简单题 1086 Octal Fractions 简单题 1199 Point of Intersection 简单题 1104 Leaps Tall Buildings 简单题 1110

xuhaofeng221

《模式识别与数据挖掘》配套PPT课件

《模式识别与数据挖掘》配套PPT课件

Bryan Ding

科技成果转化项目进场交易前,评估备案环节需要准备哪些材料?_8.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

人工智能通识教育(中职版)课程标准+PPT课件+部分素材+电子活页+在线考核

人工智能通识教育(中职版)课程标准+PPT课件+部分素材+电子活页+在线考核

Bryan Ding

跨境电商供应链管理(AIGC版)课件+教案+参考答案

跨境电商供应链管理(AIGC版)课件+教案+参考答案

Bryan Ding
评论
收藏 已收藏
分享
返回顶部
buptwaitme2002
C语言 70,039 成员 243,237 内容