BZOJ 2761
-
题目
-
分析
用 m a p map map 标记第一次出现,之后再出现就不输出就可以了
h a s h hash hash 表的方法一直 R E RE RE 洛谷能够通过,可能洛谷数据水吧。。。有时间研究一下。。。
记录一下 h a s h hash hash 质数表
61, 83, 113, 151, 211, 281, 379, 509 683, 911 / 一千以下 \\ 1217, 1627, 2179, 2909, 3881, 6907, 9209, /一万以下 \\ 12281, 16381, 21841, 29123, 38833, 51787, 69061, 92083, /十万以下\\ 122777, 163729, 218357, 291143, 388211, 517619, 690163, 999983, /百万以下\\ 1226959, 1635947, 2181271, 2908361, 3877817, 5170427, 6893911, 9191891, /千万以下\\ 12255871, 16341163, 21788233, 29050993, 38734667, 51646229,68861641, 91815541,/一亿以下\\ 1e9+7 和 1e9+9 //十亿左右\\ 122420729,163227661,217636919,290182597,386910137,515880193,687840301,917120411,/十亿以下\\ 1222827239,1610612741, 3221225473ul, 4294967291ul /十亿以上
-
代码
const int N = 5e4 + 5; int a[N]; map<int, int> mp; int main () { //freopen("input.in", "r", stdin); //freopen("test.out", "w", stdout); int t; read(t); while (t--) { mp.clear(); int n; read(n); for (int i = 1; i <= n; i++) read(a[i]); for (int i = 1; i <= n; i++) { if (!mp[a[i]]) { printf("%d ", a[i]); mp[a[i]] = 1; } else continue; } puts(""); } return 0 ; }
-
题型
h a s h hash hash