跳到正文

科技·工程

Happy New Year !

FReQuenter约 8 分钟
原文
文章信息与版本

文章信息

发布
2021年12月31日
收录
2025年12月12日
更新
2026年11月15日
篇幅
约 8 分钟

版本

  1. v1当前

字符画:HAPPY NEW YEAR !

精简版(高速版):

完整版(享受版)在下方!

cin cout 缓冲区每次都跟一个 flush 不方便,printf scanf 不能输出 string , 就用快读、快写啦!


C++
#include<cstdio>
#include<string>
#include<cstring>
namespace fastio{
    inline void read(int &n){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}n=x*f;}
    inline void print(int n){if(n<0){putchar('-');n*=-1;}if(n>9) print(n/10);putchar(n % 10 + '0');}
    inline void print(const std::string &s){int l=s.length();for(int i=0;i<l;i++) putchar(s[i]);}
    inline void print(const char &c){putchar(c);}
    inline void print(const char *a,int l){for(int i=0;i<l;i++) putchar(a[i]);}
    inline void print(const char *a){int lll=strlen(a);for(int i=0;i<lll;i++) putchar(a[i]);}
};
#include<windows.h>
using namespace std;
using namespace fastio;
string a[12]={
	"H   H  AAAAA  PPPPP  PPPPP Y   Y",
	"H   H  A   A  P   P  P   P Y   Y",
	"HHHHH  AAAAA  PPPPP  PPPPP YYYYY",
	"H   H  A   A  P      P       Y  ",
	"H   H  A   A  P      P       Y  ",
	"                                ",
	"                                ",
	"N   N  EEEEE  W W W       Y   Y  EEEEE  AAAAA  RRRRR  !!!",
	"NN  N  E      W W W       Y   Y  E      A   A  R   R  !!!",
	"NNN N  EEEEE  W W W       YYYYY  EEEEE  AAAAA  RRRRR  !!!",
	"N NNN  E      W W W         Y    E      A   A  RRR    !!!",
	"N  NN  EEEEE  WWWWW         Y    EEEEE  A   A  R  RR   . ",
};
void slowout(string a){
	for(int i=0;i<a.length();i++){
		print(a[i]);
		fflush(stdout);
		Sleep(20);
	}
}
int main(){
	slowout("On 2021/12/31, Frank says to everyone: ");
	print("\n\n");
	for(int i=0;i<12;i++){
		slowout(a[i]);
		print('\n');
	}
	print('\n');
	slowout("Thank you!");
	system("color 0F");
	return 0;
}

完整版(享受版):

确保你在 WindowsWindows 下,并没有使用在线IDE!

C++
#include<cstdio>
#include<string>
#include<cstring>
namespace fastio{
    inline void read(int &n){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}n=x*f;}
    inline void print(int n){if(n<0){putchar('-');n*=-1;}if(n>9) print(n/10);putchar(n % 10 + '0');}
    inline void print(const std::string &s){int l=s.length();for(int i=0;i<l;i++) putchar(s[i]);}
    inline void print(const char &c){putchar(c);}
    inline void print(const char *a,int l){for(int i=0;i<l;i++) putchar(a[i]);}
    inline void print(const char *a){int lll=strlen(a);for(int i=0;i<lll;i++) putchar(a[i]);}
};
#include<windows.h>
using namespace std;
using namespace fastio;
string a[12]={
	"H   H  AAAAA  PPPPP  PPPPP Y   Y",
	"H   H  A   A  P   P  P   P Y   Y",
	"HHHHH  AAAAA  PPPPP  PPPPP YYYYY",
	"H   H  A   A  P      P       Y  ",
	"H   H  A   A  P      P       Y  ",
	"                                ",
	"                                ",
	"N   N  EEEEE  W W W       Y   Y  EEEEE  AAAAA  RRRRR  !!!",
	"NN  N  E      W W W       Y   Y  E      A   A  R   R  !!!",
	"NNN N  EEEEE  W W W       YYYYY  EEEEE  AAAAA  RRRRR  !!!",
	"N NNN  E      W W W         Y    E      A   A  RRR    !!!",
	"N  NN  EEEEE  WWWWW         Y    EEEEE  A   A  R  RR   . ",
};
void slowout(string a){
	for(int i=0;i<a.length();i++){
		switch(a[i]){
			case 'H':system("color 01");break;
			case 'A':system("color 02");break;
			case 'P':system("color 03");break;
			case 'Y':system("color 04");break;
			case 'N':system("color 05");break;
			case 'E':system("color 06");break;
			case 'W':system("color 07");break;
			case 'R':system("color 08");break;
		}
		print(a[i]);
		fflush(stdout);
		Sleep(20);
	}
}
int main(){
	slowout("On 2021/12/31, Frank says to everyone: ");
	print("\n\n");
	for(int i=0;i<12;i++){
		slowout(a[i]);
		print('\n');
	}
	print('\n');
	slowout("Thank you!");
	system("color 0F");
	return 0;
}

END.

2021/12/31 16:09

HAPPY NEW YEAR !

原文
存档评论2 条抓取于