ACM Brush problems need to pay attention to the problem of input and output

Source: Internet
Author: User

Here is a summary of the issues to be aware of the brush problem:

1. scanf function return value is the number of variables read out, not read to the data returned -1,eof is a predefined constant, 1;

2. The scanf function reads the data and cannot specify the accuracy. such as: scanf ("%7.2f", &n);

3. The C language does not support defining variables in a for statement. such as: for (int i=0; i<4; i++) is not legal.


Three types of inputs:

1. Variable data: Use while (scanf ("%d", &n)! = EOF);

2. Given the number of data: With scanf ("%d", &n); while (n--) {};

3. End with a value or symbol: With while (scanf ("%d", &n), N).


Three kinds of output:

1. Direct output data and then line;

2. Each group of data followed by a blank line;

3. No two sets of data are followed by a blank line, and the last set of data wraps.

ACM Brush problems need to pay attention to the problem of input and output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.