标签:
题目大意:
分析:
AC code:
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef double DB;
typedef long double LD;
using namespace std;
int a[4];
int num[100000][4];
void pre()
{
for(int i = 0; i <= 100000; ++i)
{
if(!i) num[i][1] = 1;
if(i) num[i][2] = 1;
if(i > 1) num[i][3] = i-1;
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
pre();
int Test, n;
scanf("%d", &Test);
while(Test--)
{
scanf("%d", &n);
for(int i = 2; i <= 100000; ++i)
if(num[i][3] < n) n -= num[i][3];
else {a[3] = i;break;}
for(int i = 1; i <= 100000; ++i)
if(num[i][2] < n) n -= num[i][2];
else {a[2] = i;break;}
for(int i = 0; i <= 100000; ++i)
if(num[i][1] < n) n -= num[i][1];
else {a[1] = i;break;}
if(a[1] == 0 && a[2] == 1 && a[3] > 2) puts("YES");
else puts("NO");
}
#ifndef ONLINE_JUDGE
fclose(stdin);
fclose(stdout);
#endif
return 0;
}
标签:
原文地址:http://blog.csdn.net/qq_20118433/article/details/46393105