| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re: 麻烦帮我看一下,谢谢!In Reply To: 麻烦帮我看一下,谢谢! Posted by:liuxiaolu at 2004-12-22 17:24:41 > #include<stdio.h>//呵呵有很多地方和易福梅德一样我就不多说了
void main(){
int n,i,j;
scanf("%d\n",&n);
while(n>=0&&n<=20){
for(j=0;j<n;j++){
int a[5];
for(i=0;i<4;i++){//这个循环中有好多毛病
scanf("%d ",&a[i]);//你没有给整个数组赴完值,下面的判断好像是有问题
for(i=0;i<2;i++){
if(a[i+1]*2==a[i]+a[i+2]) a[5]=2*a[4]-a[3];//你这个地方数组越界了a[5]包括a[0....4];a[4]=2*a[3]-a[2];
if(a[i+2]/a[i+1]==a[i+1]/a[i]) a[5]=a[4]*a[4]/a[3];//同上
}//你这样会增加运行时间,不好说,在着我就不多说了
}
for(i=0;i<=4;i++){
printf("%d ",a[i]);
printf("\n");//这个应该在循环外面,否则他每输出一个值他就会接着输出一个换行符,这样就和答案要求的不一样了
}
}
}
}//答案件易福梅的问题
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator