#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int a1,a2,b1,b2,c1,c2,n;
scanf("%d %d %d",&a1,&b1,&c1);
scanf("%d %d %d",&a2,&b2,&c2);
scanf("%d",&n);
int x1,x2,y1,y2;
int a[x1];
int b[x1];
int c;
for(x1=0;x1<=n;x1++){
x2=n-x1;
y1=a1*x1*x1+b1*x1+c1;
y2=a2*x2*x2+b2*x2+c2;
a[x1]=y1;
a[x1+1]=y2;
b[x1]=y1+y2;
}
for(x1=0;x1<n;x1++){
for(x1=0;x1<n;x1++)
if(b[x1]>b[x1+1]){
int d=b[x1];
b[x1]=b[x1+1];
b[x1+1]=d;
}
}
x1=n;
printf("%d ", b[x1]);
return 0;
}
#include
#include
int main(int argc, char *argv[]) {
int a1,a2,b1,b2,c1,c2,n;
scanf("%d %d %d",&a1,&b1,&c1);
scanf("%d %d %d",&a2,&b2,&c2);
scanf("%d",&n);
int x1,x2,y1,y2;
int a[x1];
int b[x1];
int c;
for(x1=0;x1<=n;x1++){
x2=n-x1;
y1=a1*x1*x1+b1*x1+c1;
y2=a2*x2*x2+b2*x2+c2;
a[x1]=y1;
a[x1+1]=y2;
b[x1]=y1+y2;
}
for(x1=0;x1<n;x1++){
for(x1=0;x1<n;x1++)
if(b[x1]>b[x1+1]){
int d=b[x1];
b[x1]=b[x1+1];
b[x1+1]=d;
}
}
x1=n;
printf("%d ", b[x1]);
return 0;
}
你宣告int a[x1]
但這時x1還沒賦值阿