UVA 12611 - Beautiful Flag
Solve in C:
#include<stdio.h>
int main()
{
int i,n,r,x1,x11,y1,y11,x2,x22,y2,y22,w,l;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&r);
l=r*5.0;
w=(l*6)/10.0;
x1=-1*(.45*l);
y1=w*.5;
x11=l*.55;
y11=w*.5;
x2=l*.55;
y2=-1*(w*.5);
x22=-1*(.45*l);
y22=-1*(w*.5);
printf("Case %d:\n%d %d\n%d %d\n%d %d\n%d %d\n",i,x1,y1,x11,y11,x2,y2,x22,y22);
}
}
#include<stdio.h>
int main()
{
int i,n,r,x1,x11,y1,y11,x2,x22,y2,y22,w,l;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&r);
l=r*5.0;
w=(l*6)/10.0;
x1=-1*(.45*l);
y1=w*.5;
x11=l*.55;
y11=w*.5;
x2=l*.55;
y2=-1*(w*.5);
x22=-1*(.45*l);
y22=-1*(w*.5);
printf("Case %d:\n%d %d\n%d %d\n%d %d\n%d %d\n",i,x1,y1,x11,y11,x2,y2,x22,y22);
}
}
No comments