开O2直接RE,不开就过了???
查看原帖
开O2直接RE,不开就过了???
1267321
zhrhh123456楼主2025/1/18 16:22

Why???

#include<bits/stdc++.h>
using namespace std;
int n, a[200], l;
string s[100], tmp, ans;
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> s[i];
        a[i] = 1;
    }
    cin >> tmp;
	l = tmp.size();
    for (int i = 0; i < l; i++) {
        for (int j = 1; j <= n; j++) {
            if (a[j] == 1 && s[j][i] != tmp[i]) a[j] = 0;
        }
    }
    for (int i = 1; i <= 32; i++) {
    	ans[i] = '*';
	}
    for (int i = 1; i <= n; i++) {
    	if (a[i] == 1) {
    		ans[s[i][l] - (64-3)] = s[i][l];
		}
	}
    for (int i = 1; i <= 32; i++) {
		cout << ans[i];
		if (i % 8 == 0) {
			cout << "\n";
		}
	}
    return 0;
}
2025/1/18 16:22
加载中...