A. Hungry Student Problem
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken.

CFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a large one — 7 chunks. Ivan wants to eat exactly x chunks. Now he wonders whether he can buy exactly this amount of chicken.

Formally, Ivan wants to know if he can choose two non-negative integers a and b in such a way that a small portions and b large ones contain exactly x chunks.

Help Ivan to answer this question for several values of x!

Input

The first line contains one integer n (1 ≤ n ≤ 100) — the number of testcases.

The i-th of the following n lines contains one integer xi (1 ≤ xi ≤ 100) — the number of chicken chunks Ivan wants to eat.

Output

Print n lines, in i-th line output YES if Ivan can buy exactly xi chunks. Otherwise, print NO.

Example
input
2
6
5
output
YES
NO
Note

In the first example Ivan can buy two small portions.

In the second example Ivan cannot buy exactly 5 chunks, since one small portion is not enough, but two small portions or one large is too much.

【分析】:刚开始以为是拓展欧几里得解不定方程(被骚操作冲昏头脑的我)···后来才发现两个for枚举就行。

【代码】:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define oo 10000000
const int mod = 1e6;
int l,n,m;
int ans;
int main()
{
int t,f;
scanf("%d",&t);
while(t--)
{
f=;
scanf("%d",&n);
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
if(*i+*j==n)
{
f=;
break;
}
}
if(f) break;
}
//printf("%d\n",f);
if(f) puts("YES");
else puts("NO");
}
return ;
}

双重枚举

Educational Codeforces Round 34 A. Hungry Student Problem【枚举】的更多相关文章

  1. Educational Codeforces Round 34 (Rated for Div. 2) A B C D

    Educational Codeforces Round 34 (Rated for Div. 2) A Hungry Student Problem 题目链接: http://codeforces. ...

  2. Educational Codeforces Round 40 F. Runner's Problem

    Educational Codeforces Round 40 F. Runner's Problem 题意: 给一个$ 3 * m \(的矩阵,问从\)(2,1)$ 出发 走到 \((2,m)\) ...

  3. Educational Codeforces Round 34 (Rated for Div. 2)

    A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input sta ...

  4. Educational Codeforces Round 34

    F - Clear The Matrix 分析 题目问将所有星变成点的花费,限制了行数(只有4行),就可以往状压DP上去靠了. \(dp[i][j]\) 表示到第 \(i\) 列时状态为 \(j\) ...

  5. Educational Codeforces Round 34 (Rated for Div. 2) D - Almost Difference(高精度)

    D. Almost Difference Let's denote a function You are given an array a consisting of n integers. You ...

  6. Educational Codeforces Round 34 (Rated for Div. 2) C. Boxes Packing

    C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  7. Educational Codeforces Round 34 D. Almost Difference【模拟/stl-map/ long double】

    D. Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  8. Educational Codeforces Round 34 C. Boxes Packing【模拟/STL-map/俄罗斯套娃】

    C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  9. Educational Codeforces Round 34 B. The Modcrab【模拟/STL】

    B. The Modcrab time limit per test 1 second memory limit per test 256 megabytes input standard input ...

随机推荐

  1. 【Isamaru, Hound of Honda】SVN常用命令补遗

    一些常用的 就是svn commit的时候 都必须是最新版本的东西 不能不是,但是其实只是.svn在控制,所以可以update到最新版本再svn merge -r 20:10 将版本10和20的融合, ...

  2. 二分法:CF371C-Hamburgers(二分法+字符串的处理)

    Hamburgers Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u    Desc ...

  3. 动态规划:HDU-2542-0-1背包问题:饭卡

    解题心得: 这题就是一个简单的0-1背包问题,只不过加了一系列的限制.可以想办法消去限制,直接转换成0-1背包问题的模板形式. 需要注意的几个点:首先对于剩余的5元钱的处理可以直接在总的钱数上将5减去 ...

  4. requests中文页面乱码解决方案【转】

    requests中文页面乱码解决方案!   请给作者点赞 --> 原文链接 Python中文乱码,是一个很大的坑,自己不知道在这里遇到多少问题了.还好通过自己不断的总结,现在遇到乱码的情况越来越 ...

  5. 【Kubernetes】资源列表

    1.Kubernetes资源列表 https://www.cnblogs.com/linuxk/p/10436260.html

  6. Django基于Pycharm开发之四[关于静态文件的使用,配置以及源码分析](原创)

    对于django静态文件的使用,如果开发过netcore程序的开发人员,可能会比较容易理解django关于静态文件访问的设计原理,个人觉得,这是一个middlerware的设计,但是在django中我 ...

  7. SQL语句Not IN优化方案

    总结网友们在CSDN社区上对于not in的优化策略,整理如下,备查.    select * from emp where emp_no not in (select emp_no from emp ...

  8. STL 里面的几个容器简叙

    出处:http://blog.csdn.net/niushuai666/article/details/6654951 list1.list的成员函数push_back()把一个对象放到一个list的 ...

  9. SDRAM学习(一)之刷新心得

    本篇博文共有两种刷新方式 SDRAM数据手册给出每隔64ms就要将所有行刷新一遍, 因此每隔64_000_000 ns/2^12=15625ns 就要刷新一次.(因为一个L-Bank的行是12位,所以 ...

  10. [oldboy-django][2深入django]ORM操作

    推荐学习博客:http://www.cnblogs.com/wupeiqi/articles/6216618.html 需求: 汇总django orm操作,代替原生mysql语句来操作数据库:里面内 ...