• 算法笔记codeup-Contest100000567


    A   

     1 #include <stdio.h>
     2 #include <math.h>
     3 int main()
     4 {
     5     double a=0;
     6     double b=0;
     7     double c=0;
     8     scanf("%lf%lf%lf",&a,&b,&c);
     9     if((b*b-4*a*c)>=0)
    10     {
    11     double r1=(-b+sqrt(b*b-4*a*c))/(2*a);
    12     double r2=(-b-sqrt(b*b-4*a*c))/(2*a);
    13     printf("r1=%7.2f
    ",r1);
    14     printf("r2=%7.2f",r2);
    15     }
    16     else{
    17         printf("No real roots!");
    18     }
    19   
    20     return 0;
    21 }

    B

     1 #include <stdio.h>
     2 int main()
     3 {   
     4     float a=0;
     5     float b=0;
     6     scanf("%f%f",&a,&b);
     7     if(a<b)
     8     {
     9         printf("%.2f %.2f",a,b);
    10     }
    11     else
    12     {
    13         printf("%.2f %.2f",b,a);
    14     }
    15     return 0;
    16 }

    C

     1 #include <stdio.h>
     2 int main()
     3 {
     4     float a=0;
     5     float b=0;
     6     float c=0;
     7     float tem=0;
     8     scanf("%f%f%f",&a,&b,&c);
     9     if(b<a)
    10      {
    11          tem=a;
    12          a=b;
    13          b=tem;
    14      }
    15     if(c<a)
    16      {
    17          tem=a;
    18          a=c;
    19          c=tem;
    20      }
    21      if(c<b)
    22      {
    23          tem=b;
    24          b=c;
    25          c=tem;
    26      }
    27      printf("%.2f %.2f %.2f",a,b,c);
    28      return 0;
    29 }

    D

     1 #include <stdio.h>
     2 int main()
     3 {
     4     int a=0;
     5     int b=0;
     6     int c=0;
     7     int tmp=0;
     8     scanf("%d%d%d",&a,&b,&c);
     9     if(a>c)
    10     {
    11         tmp=a;
    12         a=c;
    13         c=tmp;
    14     }
    15     if(b>c)
    16     {
    17         tmp=b;
    18         b=c;
    19         c=tmp;
    20     }
    21     printf("%d",c);
    22 }

    E

     1 #include <stdio.h>
     2 
     3 int main()
     4 {
     5     double money=0;
     6     double praise=0;
     7     scanf("%lf",&money);
     8     if(money<=100000)
     9     {
    10         praise=money*0.1;
    11     }
    12     else if(money<=200000)
    13     {
    14         praise=100000*0.1+(money-100000)*0.075;
    15     }
    16     else if(money<=400000)
    17     {
    18         praise=100000*0.1+100000*0.075+(money-200000)*0.05;
    19     }    
    20     else if(money<=600000)
    21     {
    22         praise=100000*0.1+100000*0.075+200000*0.05+(money-400000)*0.03;
    23     }
    24     else if(money<=1000000)
    25     {
    26         praise=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(money-600000)*0.015;
    27     }
    28     else
    29     {
    30         praise=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(money-1000000)*0.01;
    31     }
    32     printf("%.2lf",praise); 
    33 }
    When you return with glory, you will be bathed in the golden rain.
  • 相关阅读:
    HDU 5912 Fraction (模拟)
    CodeForces 722C Destroying Array (并查集)
    CodeForces 722B Verse Pattern (水题)
    CodeForces 722A Broken Clock (水题)
    CodeForces 723D Lakes in Berland (dfs搜索)
    CodeForces 723C Polycarp at the Radio (题意题+暴力)
    CodeForces 723B Text Document Analysis (水题模拟)
    CodeForces 723A The New Year: Meeting Friends (水题)
    hdu 1258
    hdu 2266 dfs+1258
  • 原文地址:https://www.cnblogs.com/DrunkYouth/p/11852869.html
Copyright © 2020-2023  润新知