如果你本地能编译而Luogu编译失败

P3370 【模板】字符串哈希

请问一下,这个为什么CE了? ```c++ #include<bits/stdc++.h> using namespace std; #define ull unsigned long long const int N = 1e4 + 5; const int inf = 1e9 + 2024; int n; ull a[N]; char s[N]; ull BKDRHash(char* s) { ull p = 31, h = 0; int n = strlen(s); for (int i = 0; i < n; i++) { h = h * p + s[i] - 'a' + 1; } return h; } int main(void) { ios::sync_with_stdio(false), cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) { gets_s(s); a[i] = BKDRHash(s); } int ans = 0; sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { if (a[i] != a[i + 1]) { ans++; } } cout << ans; return 0; } ```
by phrym @ 2024-03-02 15:28:24


@[phrym](/user/93965) gets_s(s); 26行gets_s(s)未定义。
by mlemtion @ 2024-03-07 13:47:09


@[mlemtion](/user/946696) 啊?还是失败的哭了……
by phrym @ 2024-03-10 19:49:19


|