this year Noip actually "each has two questions from Noi the question bank in the extraction and the original problem based on the use of ", do not brush the question how to do."
This is the first problem article, because the topic is too water directly on the code.
1.1 Input and output of the programming basis world! Hello,
Direct output "Hello, world!" according to test instructions Can.
#include <iostream>usingnamespace std; int Main () { cout<<"Hello, world! "<<Endl; return 0 ;}
01.cpp 02 Outputs a second integer
Read into $a,b,c$, output $b$.
#include <iostream>usingnamespace std; int Main () { int a,b,c; CIN>>a>>b>>C; cout<<b<<Endl; return 0 ;}
02.cpp 03 aligning the output
The output statement should be printf ("%8d%8d%8d\n", a,b,c); .
#include <cstdio>usingnamespace std; int Main () { int a,b,c; scanf ("%d%d%d",&a,&b,&c); printf ("%8d%8d%8d\n", a,b,c); return 0 ;}
03.cpp 04 the output retains 3 decimal places floating-point number
The
Output statement should be printf ( Span style= "color: #800000;" >%.3f\n , x);
#include <cstdio>usingnamespace std; int Main () { double x; scanf ("%lf",&x); printf ("%.3f\n", x); return 0 ;}
04.cpp05 The output retains 12 decimal places floating-point number
The
Output statement should be printf ( Span style= "color: #800000;" >%.12f\n , x); and the variable x must be double type.
#include <cstdio>usingnamespace std; int Main () { double x; scanf ("%lf",&x); printf ("%.12f\n", x); return 0 ;}
05.cpp
[Noi question Bank]1.1