分支01 —— 分支10

分支01:

#include<stdio.h>
int main()
{
  int a;
    scanf("%d",&a);
    printf("Speed: %d - ",a);
    if(a>60) printf("Speeding");
    else printf("OK");
    return 0;
} 

分支02:

#include<stdio.h>
#include<math.h>
 
int main()
{ double a,b,c,d,e,f;
  scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f );
  double AB,BC,AC,ab,bc,ac;
  ab=(a-c)*(a-c)+(b-d)*(b-d);
  bc=(c-e)*(c-e)+(d-f)*(d-f);
  ac=(a-e)*(a-e)+(b-f)*(b-f);
  AB=sqrt(ab);
  BC=sqrt(bc);
  AC=sqrt(ac);
  if((AB<BC+AC)&&(BC<AB+AC)&&(AC<AB+BC))
  {
  double l=AB+BC+AC;
  double P = l / 2;
  double s = sqrt(P*(P-AB)*(P-BC)*(P-AC));
  printf("L = %.2f, A = %.2f",l,s); }
  else
  {printf ("Impossible");
  }
  return 0;
}

分支03:

#include<stdio.h>
int main()
{
  int day,w;
  scanf("%d",&day);
  w=day%5;
  if(w>0&&w<4) printf("Fishing in day %d",day);
  else printf("Drying in day %d",day); 
  return 0;
}

分支04:

#include<stdio.h>
int main()
{
  float dis,a,b;
  int time,sum;
  scanf("%f %d",&dis,&time);
  if(dis<=3.0) a=10.0;
  else{
    if(dis<=10.0) a=(dis-3)*2+10.0;
    else a=(dis-10.0)*3+24.0;
  }
  b=(time/5)*2;
  sum=int(a+0.5)+b;
  printf("%d",sum);
    return 0;
} 

分支05:

#include<stdio.h>
int main()
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==b) printf("C");
  else if(a==c) printf("B");
  else printf("A"); 
  return 0;
}

分支06:

#include<stdio.h>
int main()
{
  int a;
  scanf("%d",&a);
  if(a>=90) putchar('A');
  else if(a>=80) putchar('B');
  else if(a>=70) putchar('C');
  else if(a>=60) putchar('D');
  else putchar('E');
  return 0;
}

分支07:

#include<stdio.h>
int main()
{
  int a,b,c,temp;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b){temp=a;a=b;b=temp;}
  if(b>c)
  {   temp=b;b=c;c=temp;
      if(a>b)
    {temp=a;a=b;b=temp;}
  }
  printf("%d->%d->%d",a,b,c);
  return 0;
  
}

分支08:

#include<stdio.h>
int main ()
{
  int a,b;
  float c;
  scanf("%d %d",&a,&b);
  c=100*(a-b)/(float)b;
  if(c<10) printf("OK");
  else if(c>=10&&c<50) printf("Exceed %d%%. Ticket 200",(int)(c+0.5));
  else if(c>=50) printf("Exceed %d%%. License Revoked",(int)(c+0.5));
  return 0;
}  

分支09:

#include<stdio.h>
int main()
{
  float x,y;
  scanf("%f",&x);
  if(x>15.0) 
  {
    y=2.5*x-17.5;
    printf("%.2f",y);
  }
  else
  {
    y=4*x/3;
    printf("%.2f",y);
  }
  return 0;
}

分支10:

#include<stdio.h>
int main()
{
  double sum;
  scanf("%lf",&sum);
  if(sum<=1600) printf("%.2lf",0*sum);
  else if(sum<=2500) printf("%.2lf",0.05*(sum-1600));
  else if(sum<=3500) printf("%.2lf",0.10*(sum-1600));
  else if(sum<=4500) printf("%.2lf",0.15*(sum-1600));
  else printf("%.2lf",0.2*(sum-1600));
  return 0;
}

    原文作者:分支限界法
    原文地址: https://blog.csdn.net/wbwal159/article/details/48084281
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞