First Encounter with ACM — Making a Name

Words: 95

While I was writing code, a senior student saw me solving problems on NYOJ.

So I got praised a couple of times~ I was so excited at that moment.

Then I came across an absolute-value problem and wrote the code in seconds!

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include<stdio.h>
int main()
{
    double n;
    while(scanf("%lf",&n)!=EOF)
    if(n>0)
    {
    printf("%.2lf\n",n);
    }
    else
    {
    printf("%.2lf\n",n=-n)  ;
    }
    return 0;
}

By the way, is it appropriate to put this code under this title I came up with…

-.-

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...