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. C语言中strtod()函数的用法详解

    函数原型: #include <stdlib.h> double strtod(const char *nptr, char **endptr); C语言及C++中的重要函数. 名称含义 ...

  2. P1194 买礼物(建模)

    P1194 买礼物 题目描述 又到了一年一度的明明生日了,明明想要买B样东西,巧的是,这B样东西价格都是A元. 但是,商店老板说最近有促销活动,也就是: 如果你买了第I样东西,再买第J样,那么就可以只 ...

  3. 实验6 流类库与I/O

    Part2 基础练习 使用文件I/O流,以文本方式打开Part1中合并后的文件,在文件最后一行添加字符"merge successfully. " // 合并两个文件内容到一个新文 ...

  4. unknow table alarmtemp error when drop database (mysql)

    Q: unknow table alarmtemp error when  drop database (mysql) D: alarmtemp is table in rtmd database. ...

  5. This application has request the Runtime to terminate it in an unusual way.

    Q: CertsMV.exe  gui popup two dialogs as follow. A: 测试发现是分配内存导致,频繁分配内存(大约6M) 可能是堆管理导致 分配大内存分配失败,程序未对 ...

  6. bugku 普通的二维码

    记录下对进制转换实现的重新思考. 扫描二维码扫到了一句垃圾话. 拖到winhex里面. 一开始以为是十进制直接转ascii,发现错误. 后来发现,最大数是7,八进制转换吧. 我是打算用python的l ...

  7. 详细的Windows下安装 binwalk

    1. https://github.com/ReFirmLabs/binwalk到这里下载binwalk,下载后解压. 2. 找到下载后的文件夹, 在这里要进行安装步骤,一边按着shift,一边按着鼠 ...

  8. mvc-自定义Route

    public class CustomerRoute : RouteBase { //从路径中解析出controller.action以及其他参数,创建RouteData(其中包括HttpHandle ...

  9. 【bzoj2245】[SDOI2011]工作安排 费用流

    题目描述 你的公司接到了一批订单.订单要求你的公司提供n类产品,产品被编号为1~n,其中第i类产品共需要Ci件.公司共有m名员工,员工被编号为1~m员工能够制造的产品种类有所区别.一件产品必须完整地由 ...

  10. 【Luogu】P2468粟粟的书架(主席树+前缀和)

    题目链接 我仿佛中了个爆零debuff 本题分成两部分,五十分用前缀和,f[i][j][k]表示(1,1)到(i,j)的矩形大于等于k的有多少个数(再记录页数和),查询时二分,另外的用主席树,类似方法 ...