测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A32886. 欢迎(welcome)欢迎参加2020年常州市“程序设计小能手”比赛!小X想为你献上一张贺卡,不过…你得自己打印出来。贺卡由三行组成。其中第二行为”*Welcome,ContestantNoA!*",其中A是选手的编号。第一行和第三行相同,是和第二行字符数量 相同的"* ”组成。 你可以通过样例来理解。样例输入1样例输出**************************Welcome,Cont…

填空题 困难

题目描述

欢迎(welcome)

欢迎参加2020年常州市“程序设计小能手”比赛!小X想为你献上一张贺卡,不过…你得自己打印出来。

贺卡由三行组成。其中第二行为”*Welcome,ContestantNoA!*",其中A是选手的编号。

第一行和第三行相同,是和第二行字符数量 相同的"* ”组成。 

你可以通过样例来理解。

样例输入

1

样例输出

*************************

*Welcome,ContestantNo.1!*

*************************

参考答案

#include <bits/stdc++.h> using namespace std; inline void read( int &a ) { a = 0; char c; while ( (c = getchar() ) < 48 ) ; do a = a * 10 + (c ^ 48); while ( (c = getchar() ) > 47 ); } inline void write( int x ) { if ( x < 0 ) { x = -x; putchar( '-' ); } if ( x > 9 ) write( x / 10 ); putchar( x % 10 + '0' ); } int n, m, x, y, d; int main() { string s; cin >> s; int l = 24 + s.size(); for ( int i = 0; i < l; i++ ) { cout << '*'; } cout << "\n"; cout << "*Welcome,ContestantNo." << s << "!*"; cout << "\n"; for ( int i = 0; i < l; i++ ) { cout << '*'; } }
上一题 下一题