Single Round Match

本文介绍了一个基于特定条件的情侣匹配问题。该问题要求在派对上将N位男士与M位女士分成11组,每组包含相同数量的情侣。通过分析输入数据,并利用能否被11整除的特性来判断是否可以实现这一目标。本文提供了具体的输入输出样例及C++实现代码。

Single Round Match

(Input File: single.in / Standard Output)

Association for Couples Match (ACM) is a non-profit organization which is engaged in helping single people to find his/her other half. As November 11th is “Singles Day”, on this day, ACM invites a large group of singles to the party. People round together, chatting with others, and matching partners.
There are N gentlemen and M ladies in the party, each gentleman should only match with a lady and vice versa. To memorize the Singles Day, ACM decides to divide people into 11 groups, each group should have the same amount of couples and no people are left without the groups.
Can ACM achieve the goal?

Input:

The first line of the input is a positive integer T. T is the number of test cases followed. Each test case contains two integer N and M (0<=N, M<=101000), which are the amount of

gentlemen and ladies.

Output:

For each test case, output “YES” if it is possible to find a way, output “NO” if not.

Sample Input:

3
1 1
11 11
22 11

Sample Output:

NO
YES
NO

与能否被11整除的题结合起来的题。。。
AC代码:

#include <iostream>
#include <cstring>
using namespace std;
int fun(char* p)
{
    int i=0;
    long long sum=0;
    while (p[i]!='\0')
    {
        if(i&1)
        sum+=-(p[i]-'0');
        else
            sum+=p[i]-'0';
        i++;
    }
    if (sum%11==0)return 1;
    return 0;
}
int main()
{
    int N;
    char n[1001],m[1001];
    cin >> N;

    while (N--)
    {
        cin >> n >> m;
        if (strcmp(n,m)==0&&fun(m))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}
#薪资列将月薪和时薪转换为日薪: import pandas as pd import re # 读取数据 df = pd.read_excel('boss岗位.xlsx') # 定义薪资转换函数 def convert_to_daily(salary): if pd.isna(salary): return None # 匹配“X-YK·N薪” match1 = re.search(r'(\d+)-(\d+)K·(\d+)薪', salary) if match1: min_salary = int(match1.group(1)) max_salary = int(match1.group(2)) avg_monthly = (min_salary + max_salary) / 2 * 1000 daily_salary = round(avg_monthly / 22, 2) return f"{daily_salary}元/天" # 匹配“X-YK” match2 = re.search(r'(\d+)-(\d+)K', salary) if match2: min_salary = int(match2.group(1)) max_salary = int(match2.group(2)) avg_monthly = (min_salary + max_salary) / 2 * 1000 daily_salary = round(avg_monthly / 22, 2) return f"{daily_salary}元/天" # 匹配“X-Y元/天” match3 = re.search(r'(\d+)-(\d+)元/天', salary) if match3: min_salary = int(match3.group(1)) max_salary = int(match3.group(2)) daily_salary = (min_salary + max_salary) / 2 return f"{daily_salary}元/天" # 匹配“X-K”(单月薪值) match4 = re.search(r'(\d+)K', salary) if match4: salary_k = int(match4.group(1)) monthly_salary = salary_k * 1000 daily_salary = round(monthly_salary / 22, 2) return f"{daily_salary}元/天" # 无法转换的格式(如“面议”或纯文字) return salary # 应用函数到薪资列 df['薪资_统一'] = df['薪资'].apply(convert_to_daily) # 保存结果 df.to_excel('处理好的薪资列.xlsx', index=False) 帮我修改代码把薪资单位统一转换成**-**元/天
最新发布
06-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值