Hungry Student Problem_Codeforces
原题链接:http://codeforces.com/problemset/problem/903/A
1 second
256 megabytes
standard input
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 blarge ones contain exactly x chunks.
Help Ivan to answer this question for several values of x!
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.
Print n lines, in i-th line output YES if Ivan can buy exactly xi chunks. Otherwise, print NO.
2 6 5
YES NO
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.
重点:3与7互质,根据不定方程的整数解,进行特判6个不符合条件的数,其后全为符合条件的数
#include<cstdio>int main()
{int n;scanf("%d", &n);for(int i = 0; i < n; i++){int temp;scanf("%d", &temp);if(temp == 1 || temp == 2 || temp == 4 || temp == 5 || temp == 8 || temp == 11)printf("NO\n");elseprintf("YES\n");}return 0;
}
Hungry Student Problem_Codeforces相关推荐
- Codeforces 题目合集+分类+代码 【Updating...】【361 in total】
961A - Tetris 模拟 ...
- Qt入门基础知识(vs2017+Qt5.12)
声明:参考(最新QT从入门到实战完整版|传智教育_哔哩哔哩_bilibili) 做的笔记. #pragma execution_character_set("utf-8")//防止 ...
- Qt(c++)入门知识总结
文章目录 信号槽机制 .pro文件 按钮(QPushButton) Qt窗口坐标系 Lambda QMainWindow 菜单栏: 工具栏 状态栏 铆接部件(浮动窗口) 核心部件(中心部件) 资源文件 ...
- 乔布斯+斯坦福演讲+Stay Hungry. Stay Foolish.
乔布斯+斯坦福演讲+Stay Hungry. Stay Foolish. 只有那些疯狂到以为自己能够改变世界的人,才能真正改变世界 You can't connect the dots looking ...
- Stay Hungry, Stay Foolish(求知若饥,虚心若愚)
Stay Hungry, Stay Foolish(求知若饥,虚心若愚) I am honored to be with you today at your commencement from one ...
- Stay hungry, Stay foolish 的原义
乔布斯在斯坦福大学毕业演讲中说过,他最喜欢的一句话叫做"Stay hungry, Stay foolish". "Stewart和他的人出了好几期<地球产品目录&g ...
- Stay Hungry. Stay Foolish
史蒂夫 乔布斯(Steve Paul Jobs)苹果电脑公司和皮克斯动画公司(Pixar)首席执行官.以下是Steve Jobs在2005年6月12日斯坦福大学毕业典礼上的演讲. "Stay ...
- 重温乔布斯在斯坦福大学的经典演讲------Stay Hungry, Stay Foolish
多年前, 早就把乔布斯在斯坦福大学的演讲吟诵得滚瓜烂熟了, 现在还经常在嘴里蹦出几句经典的话语. 周末在家, 打开视频, 听听, 再次震彻人心. 刚才自己又朗读了一遍, 还是很顺畅, 朗朗上口. 最 ...
- 乔布斯2005年斯坦福大学毕业典礼演讲原文 – Stay hungry, stay foolish
转自:http://blog.csdn.net/souichiro/article/details/6284040 http://baidu.ku6.com/watch/635291011978059 ...
最新文章
- android bitmap 转drawable,android Drawable转换成Bitmap失败
- PHP自动加载__autoload的工作机制
- ServiceStack.Redis——Redis于.net向上client解
- 【嵌入式】C语言高级编程-长度为0的数组(05)
- 青岛旅游学校计算机证书,【我和我的旅校】青岛旅游学校优秀毕业生郭千瑜
- 文本标注工具——doccano
- SQL练习之两个列值的交换
- 博士申请 | 新加坡国立大学Xinchao Wang老师招收图神经网络方向博士/博后
- Spark/Flink/CarbonData技术实践最佳案例解析
- 鸡兔同笼的两种求解(C语言)
- 自学mysql教程 资料_数据库MYSQL,自学,命令,教程。
- InfoPath 2007 常见问题
- torch.cuda.amp.GradScaler(enabled=CFG.apex)是什么意思?
- Android 商品详情页
- 程序员养生书单,九本必读养生书籍,颈椎按摩,脊椎按摩,脱发植发
- 关于Error during artifact deployment. See server log for details.问题
- 机器学习--多层感知机、卷积神经网络、循环神经网络
- 如何自己搭建一个个人网站?
- 19.0~19.11 Dates, Calendars, and Events 日历事件的处理
- spring整合jdbc配置文件