今年NOIP居然"各有两道题目从NOI题库中抽取并在原题基础上改动后使用",不好好刷题怎么行。
01 Hello, World!
根据题意直接输出 "Hello, World!" 即可。

#include <iostream> using namespace std; int main() { cout<<"Hello, World!"<<endl; return 0; }
02 输出第二个整数
读入$a,b,c$,输出$b$。

#include <iostream> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; cout<<b<<endl; return 0; }
03 对齐输出
输出语句应该是 printf("%8d %8d %8d\n",a,b,c); 。

#include <cstdio> using namespace std; int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); printf("%8d %8d %8d\n",a,b,c); return 0; }
04 输出保留3位小数的浮点数
输出语句应该是 printf("%.3f\n",x);

#include <cstdio> using namespace std; int main() { double x; scanf("%lf",&x); printf("%.3f\n",x); return 0; }
05 输出保留12位小数的浮点数
输出语句应该是 printf("%.12f\n",x); ,并且变量x必须是 double 类型的。

#include <cstdio> using namespace std; int main() { double x; scanf("%lf",&x); printf("%.12f\n",x); return 0; }
06 空格分隔输出
注意输入输出顺序。

#include <iostream> #include <cstdio> using namespace std; int main() { char a; int b; float c; double d; cin>>a>>b>>c>>d; printf("%c %d %f %f\n",a,b,c,d); return 0; }
07 输出浮点数
这个题目向我们展示了 printf("%g\n",x); 这条语句的神奇之处。根据百度,这样做可以省略所有无意义的0,而 printf("%f\n",x); 会固定输出6位小数。

#include <cstdio> using namespace std; int main() { double x; scanf("%lf",&x); printf("%f\n%.5f\n%e\n%g\n",x,x,x,x); return 0; }
08 字符三角形
注意每行末无空格。

#include <cstdio> using namespace std; int main() { char c; scanf("%c",&c); printf(" %c\n",c); printf(" %c%c%c\n",c,c,c); printf("%c%c%c%c%c\n",c,c,c,c,c); return 0; }
09 字符菱形
和上题极其相似。

#include <cstdio> using namespace std; int main() { char c; scanf("%c",&c); printf(" %c\n",c); printf(" %c%c%c\n",c,c,c); printf("%c%c%c%c%c\n",c,c,c,c,c); printf(" %c%c%c\n",c,c,c); printf(" %c\n",c); return 0; }
10 超级玛丽游戏
这题很萌~耐心做就行了。(好吧我没有原图,随便搜了一张)
******** ************ ####....#. #..###.....##.... ###.......###### ### ### ### ### ........... #...# #...# #...# #...# ##*####### #.#.# #.#.# #.#.# #.#.# ####*******###### #.#.# #.#.# #.#.# #.#.# ...#***.****.*###.... #...# #...# #...# #...# ....**********##..... ### ### ### ### ....**** *****.... #### #### ###### ###### ############################################################## ################################## #...#......#.##...#......#.##...#......#.##------------------# #...#......#.##------------------# ###########################################------------------# ###############------------------# #..#....#....##..#....#....##..#....#....##################### #..#....#....##################### ########################################## #----------# ############## #----------# #.....#......##.....#......##.....#......# #----------# #.....#......# #----------# ########################################## #----------# ############## #----------# #.#..#....#..##.#..#....#..##.#..#....#..# #----------# #.#..#....#..# #----------# ########################################## ############ ############## ############ |
![]() |

#include <iostream> using namespace std; int main() { cout<<" ********"<<endl; cout<<" ************"<<endl; cout<<" ####....#."<<endl; cout<<" #..###.....##...."<<endl; cout<<" ###.......###### ### ### ### ###"<<endl; cout<<" ........... #...# #...# #...# #...#"<<endl; cout<<" ##*####### #.#.# #.#.# #.#.# #.#.#"<<endl; cout<<" ####*******###### #.#.# #.#.# #.#.# #.#.#"<<endl; cout<<" ...#***.****.*###.... #...# #...# #...# #...#"<<endl; cout<<" ....**********##..... ### ### ### ###"<<endl; cout<<" ....**** *****...."<<endl; cout<<" #### ####"<<endl; cout<<" ###### ######"<<endl; cout<<"############################################################## ##################################"<<endl; cout<<"#...#......#.##...#......#.##...#......#.##------------------# #...#......#.##------------------#"<<endl; cout<<"###########################################------------------# ###############------------------#"<<endl; cout<<"#..#....#....##..#....#....##..#....#....##################### #..#....#....#####################"<<endl; cout<<"########################################## #----------# ############## #----------#"<<endl; cout<<"#.....#......##.....#......##.....#......# #----------# #.....#......# #----------#"<<endl; cout<<"########################################## #----------# ############## #----------#"<<endl; cout<<"#.#..#....#..##.#..#....#..##.#..#....#..# #----------# #.#..#....#..# #----------#"<<endl; cout<<"########################################## ############ ############## ############"<<endl; return 0; }