科大讯飞提前批的笔试

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

#include<iostream>
#include<vector>
using namespace std;
int main()
{
	vector<int>array;
	for (int i = 0; i < 5; ++i)
	{
		int temp;
		cin >> temp;
		array.push_back(temp);
}
	int value;
	cin >> value;
	if (value < 1)
	{
		cout << -1;
		return 0;
	}
	int money[6] = { 100,50,10,5,1 };
	int ans=0;
	for (int j = 5; j >0; --j)
	{
		while (value >= money[j] && array[j] > 0)
		{
			ans++;
			array[j]--;
			value = value - money[j];
		}
	}
   if(value!=0) return -1;
	else cout << ans << endl;
	return 0;
}

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    //矩形1
    int x1,y1,x2,y2;
    //矩形2
    int a1,b1,a2,b2;
 
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> a1 >> b1 >> a2 >> b2;
 
    if(b1 > y2 && b2 > y2)
        cout << 0;
    else if(b1 < y1 && b2 < y1)
        cout << 0;
    else if(a1 > x2 && a2 > x2)
        cout << 0;
    else if(a1 < x1 && a2 < x1)
        cout << 0;
    else
        cout << 1;
    return 0;
}

在这里插入图片描述

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	string str;
		cin >> str;
	string ans;
	bool flag = false;
for (char& c : str)
	{
		if (c == '+')
			continue;
		else if (c == '-')//负负=正
			flag = !flag;
		else //出现第一个不为+-的字符就终止
			break;
	}
	if(flag) ans+='-';
	for (char& c:str)
	{
		if (c >= '0' && c <= '9')
			ans.push_back(c);
	}
	cout << ans << endl;
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值