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. A1042 Shuffling Machine (20)

    1042 Shuffling Machine (20)(20 分) Shuffling is a procedure used to randomize a deck of playing cards ...

  2. 批量导出ppt中内嵌的图片

    某个ppt中很多页,然后插入了很多图片,且图片都是被压缩的,看起来非常费劲,所以想着一次性把图片另存为,找了接近一个小时,终于被我找到啦,分享给大家: 1.直接把ppt的后缀修改为rar 2.解压ra ...

  3. ASP.NET下调用ffmpeg与mencoder实现视频转换截屏

    最近要做一个视频播放的系统,用到了ffmpeg和mencoder两个工具,查了一些资料,发现这方面的资料还挺多的,但是就是乱了一点,我自己从头整理了一下,和大家分享一下: 1.ffmpeg实现视频(a ...

  4. Python+Selenium基础篇之3-打开和关闭IE/Chrome浏览器

    前面文章介绍了,如何调用webdriver接口方法来打开和关闭Firefox浏览器,本文介绍如何打开IE和Chrome浏览器.web项目,需要做兼容性测试,最重要的是浏览器兼容性测试.如果只考虑win ...

  5. RQNOJ 明明的随机数

    题目描述 明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应 ...

  6. C++ bitset类的使用与简介

    有些程序要处理二进制位的有序集,每个位可能包含的是0(关)或1(开)的值.位是用来保存一组项或条件的yes/no信息(有时也称标志)的简洁方法.标准库提供了bitset类使得处理位集合更容易一些.要使 ...

  7. 【转】BehaviorDesigner学习

    BehaviorDesigner学习   行为树: 行为树设计师插件是一个专门为unity设计的AI插件. 通过继承Behavior中的Task下的四个节点,可以创建自己的行为树节点. 行为树中的自定 ...

  8. Linux中Source的用法

    source命令:source命令的功能:使Shell读入指定的Shell程序文件并依次执行文件中的所有语句source命令通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录.用法 ...

  9. 服务器和客户端Socket单向通信例子

    看了两天socket通信,也参考了网上其他人是怎么写的. 下面我把最简单的socket例程贴出来 server代码: public class Server { private static int ...

  10. hihoCoder 第136周 优化延迟(二分答案+手写堆)

    题目1 : 优化延迟 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho编写了一个处理数据包的程序.程序的输入是一个包含N个数据包的序列.每个数据包根据其重要程度不同 ...