【开源社区openEuler实践】D. Meta-set

题目

思路:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define lson p << 1
#define rson p << 1 | 1
const int maxn = 1e6 + 5, inf = 1e18, maxm = 4e4 + 5;
const int N = sqrt(1e9) + 1;
 const int mod = 1e9 + 7;
// const int mod = 998244353;
//const __int128 mod = 212370440130137957LL;
// int a[505][5005];
// bool vis[505][505];

int a[maxn], b[maxn];
bool vis[maxn];
string s[maxn];
int n, m;

struct Node{
    int val, id;
    bool operator<(const Node &u)const{
        return val < u.val;
    }
};
// Node c[maxn];

int ans[maxn];
int pre[maxn];

//long long ? maxn ? n? m?

string get(string s, string t){
    string res;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == t[i]){
            res += s[i];
        }
        else{
            res += char(3 - (s[i] - '0') - (t[i] - '0') + '0');
        }
    }
    return res;
}

void solve(){
    int res = 0;
    int q, k;
    int x;
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= k; j++){
            char ch;
            cin >> ch;
            s[i] += ch;
        }
    }
    map<string, int> mp;
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            string t = get(s[i], s[j]);
            mp[t]++;
        }
    }
    for(int i = 1; i <= n; i++){
        res += mp[s[i]] * (mp[s[i]] - 1) / 2;
    }
    cout << res << '\n';
}   
    
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int T = 1;
    // cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}

在 Yocto 中,`ParseError` 通常表示解析文件时出现了语法错误。对于 `/usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb` 文件第 30 行的 `ParseError`,错误信息为 `unparsed line: 'bbwarn "The value of VAR is: ${TARGET_PREFIX}"`,可以按照以下方法排查和解决: #### 1. 检查语法错误 `bbwarn` 语句在语法上看起来没有明显错误,但需要确保变量 `${TARGET_PREFIX}` 已经被正确定义。如果该变量未定义,可能会导致解析错误。可以在 `bbwarn` 语句之前添加一些调试信息,确保变量已经被正确设置。 ```python # 在 bbwarn 语句之前添加调试信息 TARGET_PREFIX ?= "default_value" # 如果未定义,可以先给一个默认值 bbnote "TARGET_PREFIX is set to: ${TARGET_PREFIX}" bbwarn "The value of VAR is: ${TARGET_PREFIX}" ``` #### 2. 检查引号和括号 确保引号和括号使用正确,没有遗漏或多余的引号。在 `bbwarn` 语句中,双引号需要正确配对。 #### 3. 检查文件编码 确保文件的编码格式为 UTF-8,一些特殊字符或非标准编码可能会导致解析错误。可以使用以下命令检查文件编码: ```bash file -i /usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb ``` 如果编码不是 UTF-8,可以使用 `iconv` 命令进行转换: ```bash iconv -f old_encoding -t UTF-8 /usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb -o /usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb.new mv /usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb.new /usr1/openeuler/src/yocto-poky/../yocto-meta-openeuler/bsp/meta-dgri/recipes-kernel/linux/hi3403-tf-a.bb ``` #### 4. 检查文件中是否有其他语法错误 除了第 30 行,文件中其他地方的语法错误也可能影响解析。可以使用文本编辑器的语法检查功能,或者将文件内容复制到一个新的文件中,逐步添加内容,找出导致错误的具体位置。 #### 5. 检查 Yocto 版本兼容性 确保使用的 Yocto 版本与 `bbwarn` 函数兼容。不同版本的 Yocto 可能对某些函数或语法有不同的要求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

__night_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值