浙江工业大学计算机考研机试,201906浙江工业大学计算机学院转专业二志愿机试题目...

因为转专业可以报两个志愿,所以这次带来了二志愿的题目,难度并没有变化太多,这次很幸运通过了机试,但又倒在了面试上,遗憾之情难以言表,下次再来8

题号

题目

2097 Problem A

祝你一切顺利

2098 Problem B

字符处理机器

2099 Problem C

如何分解合数

2100 Problem D

旋转杨辉三角

2101 Problem E

铁打营盘流水兵

Problem A: 祝你一切顺利

Description

很高兴你想加入计算机学院这个大家庭,在此献上学院对你的衷心祝福:无论未来有无风雨,均愿你一切如意!

Input

无输入

Output

输出样本示范内容,行末回车。

Sample Output

Wish you everything goes well in the future!

#include

using namespace std;

int main()

{

cout<

return 0;

}

Problem B:字符处理机器

Description

有一台字符处理机器,输入一个字符串(串长小于500),就做如下处理:

1)大写字母处理为对应的小写字母,小写字母处理为对应的大写字母;

2)数字字符处理为加前缀*,如‘3’加工为 *3 ;

3)空格处理为’#’;

4)其他字符处理为’?’。

然后输出处理后的内容。请你来造一台这样的机器吧!

Input

按行输入多个字符串。

Output

对每一行字符串均按字符处理机器的要求工作,输出处理结果,行末回车。

Sample Input

I’m a good student.

My phone number is #123456789#

AbCd &! 34y34 80 H6^7GH

Sample Output

i?M#A#GOOD#STUDENT?

mY#PHONE#NUMBER#IS#?12345678*9?

aBcD#???#34Y34#80#h*6?*7?gh

#include

#include

#include

using namespace std;

int main()

{ char a[502];

while(gets(a))

{

char tmp[1002];

int s=strlen(a);

int p=0;

for(int i=0;i

{

if(a[i]>=65&&a[i]<=90) tmp[p++]=a[i]+32;

else if(islower(a[i])!=0) tmp[p++]=a[i]-32;

else if(isdigit(a[i])!=0) {

tmp[p++]='*'; tmp[p++]=a[i];

}

else if(a[i]==' ') tmp[p++]='#';

else tmp[p++]='?';

}

for(int i=0;i

cout<

cout<

}

return 0;

}

Problem C:如何分解合数

Description

在数学里有个基本定理:任意一个大于1的合数都可以分解成有限个素数(质数)的乘积,且分解是唯一的。证明挺麻烦,但是我们可以用计算机来验证。请你来试一试!

Input

输入若干合数(>2),输入0表示输入结束。

Output

对于每个有效的正整数输入,输出其分解为若干个素数乘积的表达式,表达式因子按升序(从小到大)输出。一个表达式一行。

Sample Input

45 36 34 18 420 0

Sample Output

8c562c6fe888790950ed3ca4917740ca.png

#include

using namespace std;

int a(int a){

int i;

for(i=2; i

if(a%i == 0)

return 0;

return 1;

}

void F(int n)

{

for (int i=2; i

if(n%i == 0)

{

cout<

if(a(n/i))

{

cout<

break;

}

else

F(n/i);

break;

}

}

void f(long long n)

{

cout<

for (int i=2; i

if(n%i == 0)

{

cout<

if(a(n/i))

{

cout<

break;

}

else

F(n/i);

break;

}

}

int main()

{

int n;

while(cin>>n)

{

if(n==0) break;

else f(n);

}

return 0;

}

Problem D:旋转杨辉三角

Description

杨辉三角是一个由数字排列成的三角形数表。其实在杨辉记录之前是由北宋人贾宪率先使用的。因此也称为贾宪三角。贾宪三角最初用作高阶开方运算,为我们现在看到的杨辉三角旋转45度得到。现在来请你重现贾宪当年使用的模样。

Input

多行输入,每行输入一个自然数(n<20),一个可显示字符。

Output

对应每个自然数n, 字符c,输出由c构成的旋转后的杨辉三角。每行每个杨辉三角值对应输出若干字符c, 输出各值之间间隔1个空格。行末回车。

例如,输入3 a

则对应旋转后的杨辉三角

1 1 1

1 2

1

于是输出

a a a

a aa

a

Sample Input

4 *

6 T

Sample Output

* * * *

* ** ***

* ***

*

T T T T T T

T TT TTT TTTT TTTTT

T TTT TTTTTT TTTTTTTTTT

T TTTT TTTTTTTTTT

T TTTTT

T

#include

using namespace std;

void print(int n,char c)

{

while(n--)

cout<

}

int main()

{

int n;char c;

while(cin>>n>>c)

{

int a[20][20];

a[0][0]=1;

for(int i=0;i

{

for(int j=0;j<=i;j++)

{

if(j==0||j==i)a[i][j]=1;

else a[i][j]=a[i-1][j-1]+a[i-1][j];

}

}

for(int k=0;k

{

for(int i=k;i

{

print(a[i][i-k],c);

if(i!=n-1)cout<

}

cout<

}

}

return 0;

}

Problem E:铁打营盘流水兵

Description

某部队在某地驻扎了10个营帐,编号分别为1,2,3,4,5,6,7,8,9,10, 每个营帐最初有若干战士。不打仗时, 每天由于训练导致的非战斗减员为1%;打仗时,每天的战斗减员为10% (减员人数四舍五入凑整,如减员1.4人为实际减员1人,减员1.5人为实际减员2人)。当营帐中的战士减员到50人以内,则由上级部队调派200新兵补充。现在部队需要知道军中士兵的分布情况,会隔若干天就派人去巡视各营帐,然后出报表呈给司令员过目。你来做这件事吧!

Input

多组输入。每组输入天数,按营帐编号顺序输入战士数, 天数对应的0,1序列(0表示当天不战斗,1表示当天战斗)。

Output

对应输入数据,给出巡视那天的战士排序报表,按格式“营帐号:人数”降序给出,不同营帐人数相同时按营帐号升序(从小到大)给出。具体格式参考样本输出。

Sample Input

26

100 200 300 400 500 600 700 800 900 1000

1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1

3

55 67 123 87 50 76 60 90 421 303

0 1 1

Sample Output

3:220 2:146 10:139 9:125 8:110 7:97 6:84 1:68 5:68 4:55

9:337 7:248 10:243 1:224 5:202 3:99 8:72 4:69 6:60 2:53

#include

#include

using namespace std;

struct wars{

int id;

int mans;

};

struct rule{

bool operator()(const wars & a,const wars & b)

{

if(a.mans!=b.mans) return a.mans>b.mans;

else return a.id

}

};

int main()

{

int day;

int man[10];

while(cin>>day)

{ multiset st;

int *war=new int[day];

for(int i=0;i<10;i++)cin>>man[i];

for(int i=0;i>war[i];

int q=0;

while(q

{ int tmp=1;

for(int i=0;i<10;i++)

{

if(war[q]==1) {

double x=man[i]*0.1;

tmp=(x*2+1)/2;

man[i]-=tmp;

}

else {

double y=man[i]*0.01;

tmp=(y*2+1)/2;

man[i]-=tmp;}

if(man[i]<50) man[i]+=200;

}

q++;

}

for(int i=0;i<10;i++)

{

wars tmp;

tmp.mans=man[i];

tmp.id=i+1;

st.insert(tmp);

}

set::iterator k=st.begin();

for(;k!=st.end();k++)

{

cout<id<mans<

}

cout<

}

return 0;

}

标签:Sample,int,Input,201906,Output,机试,Problem,浙江工业大学,输入

来源: https://blog.csdn.net/qq_44726237/article/details/94606054

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值