题目:http://acm.hdu.edu.cn/showproblem.php?pid=2003

看的时候挺简单的,还在想这上面题也太水了。

做的时候没得换得,提交了两次才发现。

 

#include <stdio.h>

int main()
{
     double a,b;
     while(scanf("%lf",&a)!=EOF)
     {

        b=a;
        if(b<0)
        {
            b=-a;
        }
        printf("%.2lf\n",b);
     }
    return 0;
}

-------------------------------------------------------------------------------


#include <stdio.h>

int main()
{
    double a;
    while(scanf("%lf",&a)!=EOF)
    {
        printf("%.2lf\n",a>0?a:-a);
    }
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-09
  • 2021-12-24
  • 2021-10-27
相关资源
相似解决方案