题解:A
A
(a.pas/c/cpp)
【题目描述】
对于给定的一个正整数n, 判断n是否能分成若干个正整数之和 (可以重复) ,
其中每个正整数都能表示成两个质数乘积。
【输入描述】
第一行一个正整数 q,表示询问组数。
接下来 q 行,每行一个正整数 n,表示询问。
【输出描述】
q 行,每行一个正整数,为 0 或 1。0 表示不能,1 表示能。
【输入样例】
5
1
4
5
21
25
【输出样例】
0
1
0
1
1
【样例解释】
4=2*2
21=6+15=2*3+3*5
25=6+9+10=2*3+3*3+2*5
25=4+4+4+4+9=2*2+2*2+2*2+2*2+3*3
【数据范围】
30%的数据满足:q<=20,n<=20
60%的数据满足:q<=10000,n<=5000
100%的数据满足:q<=105,n<=1018
solution:
因为P‘OK’,4‘OK’,所以‘P+4’OK
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int q;
LL n;
int rd(){
int re=0,f=1;char c=getchar();
while ((c<'0')||(c>'9')) {if (c=='-') f=-f;c=getchar();}
while ((c>='0')&&(c<='9')) {re=re*10+c-'0';c=getchar();}
return re*f;
}
int main(){
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
scanf("%d",&q);
for (;q>0;--q){
scanf("%lld",&n);
if ((n>3ll)&&(n!=5ll)&&(n!=7ll)&&(n!=11ll)) puts("1");else puts("0");
}
return 0;
}
题解:A的更多相关文章
- 2016 华南师大ACM校赛 SCNUCPC 非官方题解
我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...
- noip2016十连测题解
以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #incl ...
- BZOJ-2561-最小生成树 题解(最小割)
2561: 最小生成树(题解) Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1628 Solved: 786 传送门:http://www.lyd ...
- Codeforces Round #353 (Div. 2) ABCDE 题解 python
Problems # Name A Infinite Sequence standard input/output 1 s, 256 MB x3509 B Restoring P ...
- 哈尔滨理工大学ACM全国邀请赛(网络同步赛)题解
题目链接 提交连接:http://acm-software.hrbust.edu.cn/problemset.php?page=5 1470-1482 只做出来四道比较水的题目,还需要加强中等题的训练 ...
- 2016ACM青岛区域赛题解
A.Relic Discovery_hdu5982 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Jav ...
- poj1399 hoj1037 Direct Visibility 题解 (宽搜)
http://poj.org/problem?id=1399 http://acm.hit.edu.cn/hoj/problem/view?id=1037 题意: 在一个最多200*200的minec ...
- 网络流n题 题解
学会了网络流,就经常闲的没事儿刷网络流--于是乎来一发题解. 1. COGS2093 花园的守护之神 题意:给定一个带权无向图,问至少删除多少条边才能使得s-t最短路的长度变长. 用Dijkstra或 ...
- CF100965C题解..
求方程 \[ \begin{array}\\ \sum_{i=1}^n x_i & \equiv & a_1 \pmod{p} \\ \sum_{i=1}^n x_i^2 & ...
- JSOI2016R3 瞎BB题解
题意请看absi大爷的blog http://absi2011.is-programmer.com/posts/200920.html http://absi2011.is-programmer.co ...
随机推荐
- WPF 后台模拟界面触摸点击
win32Api提供一种方法,模拟用户触摸点击 InjectTouchInput function InitializeTouchInjection InjectTouchInput 在模拟添加触摸输 ...
- 如何用python查看自己的电脑有几个核
今天在研究多进程的时候,如果想要充分利用多核CPU资源,最起码的一点你应该知道自己的电脑有几个核. 下面是用python3 的 os 模块来查看自己的电脑是几个核的方法. import os prin ...
- How to: Use the Entity Framework Data Model Located in an External Assembly 如何:使用位于外部程序集中的EF数据模型
If you have a non-XAF application, and want to develop an XAF application that utilizes the same dat ...
- 松软科技web课堂:随机Math.random()
Math.random() 返回 0(包括) 至 1(不包括) 之间的随机数: 实例 Math.random(); // 返回随机数 JavaScript 随机整数 Math.random() 与 M ...
- JS---DOM---节点的概念,属性,和获取相关的节点
回顾概念 文档: document 元素: 页面中所有的标签, 元素---element, 标签----元素---对象 节点: 页面中所有的内容(标签,属性,文本(文字,换行,空格,回车))---- ...
- English: Class logogram
IT # this is a IT type ISP ANOTHER # following is another logogram LCD PDA
- 如何计算Data Guard环境中Redo所需的网络带宽传输 (Doc ID 736755.1)
How To Calculate The Required Network Bandwidth Transfer Of Redo In Data Guard Environments (Doc ID ...
- Java_枚举Enum基本使用
特性 在某些情况下,一个类的对象时有限且固定的,如季节类,它只有春夏秋冬4个对象这种实例有限且固定的类,在 Java 中被称为枚举类: 在 Java 中使用 enum 关键字来定义枚举类,其地位与 c ...
- SQL语句性能调整原则
一.问题的提出 在应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图的的编写等体会不出SQL语句各种写法的性能优劣,但是如果将应用系统提交实际应用后,随着数据库中数据的增加,系统 ...
- Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org
androidStudio打开cocos3.17.2Lua项目时,出现了 Configuration on demand is not supported by the current version ...