[ZJ]a005: Eva 的回家作業
題目:
http://zerojudge.tw/ShowProblem?problemid=a005
------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int N,a,b,c,d,r,e,s;
while(scanf("%d",&N)!=EOF){
for(int i=1;i<=N;i++)
{
scanf("%d %d %d %d",&a,&b,&c,&d);
if(b - a == c - b)
{
s = b - a;
e = a + 4 * s;
printf("%d %d %d %d %d",a,b,c,d,e);
}
else if(b / a == c / b)
{
r = b / a;
e = a * r * r * r * r;
printf("%d %d %d %d %d",a,b,c,d,e);
}
printf("\n");
}
}
return 0;
}
http://zerojudge.tw/ShowProblem?problemid=a005
------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int N,a,b,c,d,r,e,s;
while(scanf("%d",&N)!=EOF){
for(int i=1;i<=N;i++)
{
scanf("%d %d %d %d",&a,&b,&c,&d);
if(b - a == c - b)
{
s = b - a;
e = a + 4 * s;
printf("%d %d %d %d %d",a,b,c,d,e);
}
else if(b / a == c / b)
{
r = b / a;
e = a * r * r * r * r;
printf("%d %d %d %d %d",a,b,c,d,e);
}
printf("\n");
}
}
return 0;
}
留言
張貼留言