51nod 1087 1 10 100 1000【打表】
第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000)
第2 - T + 1行:每行1个数N。(1 <= N <= 10^9)
共T行,如果该位是0,输出0,如果该位是1,输出1。
3
1
2
3
1
1
0 【代码】:
#include <bits/stdc++.h> using namespace std; const int maxn = +;
int a[maxn];
int n; int main()
{
int flag;
int t;
for(int i=;i<maxn;i++)
{
a[i]=(i*(i-))/+;
}
cin>>t;
while(t--)
{
cin>>n;
flag=;
for(int i=;i<=n;i++)
{
if(a[i]==n)
{
printf("1\n");
break;
}
if(a[i]>n)
{
flag=;
break;
}
}
if(flag==)
printf("0\n");
}
}
51nod 1087 1 10 100 1000【打表】的更多相关文章
- 51NOD 1087 1 10 100 1000
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 暴力大法 #include<bits/stdc++.h> ...
- 51Nod 1087 1 10 100 1000 | 数学
Input示例 3 1 2 3 Output示例 1 1 0 #include "bits/stdc++.h" using namespace std; #define LL lo ...
- 1087 1 10 100 1000(打表 set 数学)
1087 1 10 100 1000 题目来源: Ural 1209 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 1,10,100,1000... ...
- Ural 1209. 1, 10, 100, 1000... 一道有趣的题
1209. 1, 10, 100, 1000... Time limit: 1.0 secondMemory limit: 64 MB Let's consider an infinite seque ...
- Timus - 1209 - 1, 10, 100, 1000...
先上题目: 1209. 1, 10, 100, 1000... Time limit: 1.0 secondMemory limit: 64 MB Let's consider an infinite ...
- [51NOD1087]1 10 100 1000(规律,二分)
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 用高中的数列知识就可以推出公式,不难发现f(n)=f(n ...
- 背水一战 Windows 10 (100) - 应用间通信: 分享
[源码下载] 背水一战 Windows 10 (100) - 应用间通信: 分享 作者:webabcd 介绍背水一战 Windows 10 之 应用间通信 分享 示例1.本例用于演示如何开发一个分享的 ...
- 用js实现随机选取10–100之间的10个数字,存入一个数组,并排序
var iArray = []; function getRandom(istart, iend) { var iChoice = iend - istart + 1; //加1是为了取到100 va ...
- python 统计MySQL大于100万的表
一.需求分析 线上的MySQL服务器,最近有很多慢查询.需要统计出行数大于100万的表,进行统一优化. 需要筛选出符合条件的表,统计到excel中,格式如下: 库名 表名 行数 db1 users 1 ...
随机推荐
- @property后面可以有哪些修饰符?
原子性---nonatomic特质 如果不写默认情况为atomic(系统会自动加上同步锁,影响性能) 在iOS开发中尽量指定为nonatomic,这样有助于提高程序的性能 读/写权限---readwr ...
- USACO Section2.1 Hamming Codes 解题报告 【icedream61】
hamming解题报告----------------------------------------------------------------------------------------- ...
- USACO Section1.2 Dual Palindromes 解题报告
dualpal解题报告 —— icedream61 博客园(转载请注明出处)-------------------------------------------------------------- ...
- 《算法》C++代码 SPFA
SPFA的全称是Shortest Path Faster Algorithm,一看名称八成就是中国人起的名字,因为外国人起算法名称一般都会写上自己的名字,很少谦虚.实际上,这是西南交通大学段凡丁同学于 ...
- 了解JavaScript核心精髓(三)
1.js判断对象是否存在属性. hasOwnProperty(‘property’) 判断原型属性是否存在. "property" in o; 判断原型属性和原型链属性是否存在 ...
- katalon系列一:初识Katalon Studio自动化测试工具
最近准备把公司的系统搞上UI自动化,先是自己用Python+selenium+pytest写了一个框架,开始写case的时候发现效率极其慢.原因为: (1)开发为提高前端响应时间,使用前端路由技术,一 ...
- Python全栈工程师(异常(基础))
ParisGabriel 每天坚持手写 一天一篇 决定坚持几年 为了梦想为了信仰 Python人工智能从入门到精通 补充:包的相对导入 只对后两种导入方式有用 ...
- Spring Boot多数据源配置(二)MongoDB
在Spring Boot多数据源配置(一)durid.mysql.jpa 整合中已经讲过了Spring Boot如何配置mysql多数据源.本篇文章讲一下Spring Boot如何配置mongoDB多 ...
- 大图轮播js
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> ...
- Application_Start事件中用Timer做一个循环任务
protected void Application_Start(object sender, EventArgs e) { System.Timers.Timer timer = new Syste ...