1 条题解
-
1
暴力枚举即可,注意用
bitset
。#include "bits/stdc++.h" using namespace std; const int N = int(1e9); typedef long long ll; bitset<N + 50> b; int s = 1, w; int main() { for (register int i = 1; i <= 100000; ++i) { if (s <= N) { b[s] = 1; s += i; } else { break; } } int t; scanf ("%d", &t); for(int i = 1;i <= t;++i) { scanf ("%d", &w); // cout << "CCF" << endl; if (b[w]) puts("1"); else puts("0"); } }
内存:125.5 MiB
《为什么 bitset 是神》
- 1
信息
- ID
- 316
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 111
- 已通过
- 29
- 上传者