7 生日打题

#include<iostream>
#include<cstring>
using namespace std;
bool arr[100];
int main()
{
	int k;
	cin >> k;
	int ans = k;
	while (1)
	{
		memset(arr,0, sizeof(arr));
		int s = 0;
		int cnt = 0;
		//cout << ans << ":";
		for(int j=1;j<=k;j++)
		{
			for (int i = 1;i <= ans;i++)
			{
				s++;
				if (s == k * 2 + 1)s = 1;
				while (arr[s] == 1)
				{
					s++;
					if (s == k * 2 + 1)s = 1;
				}
			}
			//cout << s << " ";
			arr[s] = 1;
			if (s <= k)
			{
				ans++;
				//cout << endl;
				break;
			}
			else
			{
				cnt++;
			}
		}
		if (cnt == k)
		{
			cout << ans << endl;
			return 0;
		}
		
	}
	return 0;
}

 

#include<iostream>
using namespace std;
int n, m;
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<cmath>
long long gcd(int x, int y)
{
	if (y == 0)return x;
	else return gcd(y, x % y);
}
int main()
{
	cin >> n >> m;
    int flag = 0;
    long long ans = 0;
    for (int i = 1;i <= sqrt(1ll * m * n);i++)
    {
        if ((1ll * n * m) % i == 0 && gcd(i, (1ll * n * m) / i) == n)
        {
            ans++;
            if (1ll * i * i == 1ll * n * m)  flag = 1;
        }
    }
    cout << ans * 2 - flag;
	return 0;
}

 

#include<iostream>
using namespace std;
#include<string>
int n;
int main()
{
	cin >> n;
	string ans1;
	long long ans2 = 0;
	string name;
	long long sum = 0;
	int qimo, banyi;
	char ch1, ch2;
	int lunwen;
	for (int i = 1;i <= n;i++)
	{
		cin >> name;
		cin >> qimo >> banyi;
		cin >> ch1 >> ch2;
		cin >> lunwen;
		int res = 0;
		if (qimo > 80 && lunwen >= 1)
		{
			res += 8000;
		}
		if (qimo > 85 && banyi > 80)
		{
			res += 4000;
		}
		if (qimo > 90 )
		{
			res += 2000;
		}
		if (qimo > 85 && ch2 == 'Y')
		{
			res += 1000;
		}
		if (banyi > 80 && ch1 == 'Y')
		{
			res += 850;
		}
		sum += res;
		if (res > ans2)
		{
			ans1 = name;
			ans2 = res;
		}
	}
	cout << ans1 << endl << ans2 << endl << sum << endl;
	return 0;
}

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值