http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087

暴力大法

#include<bits/stdc++.h>
using namespace std;
map <int,int>s; void solve()
{
int i=,k=;
while (i<=1e9)
{
s[i] = ;
i+=k;
k++;
}
} int main ()
{
int t,n;
solve();scanf("%d",&t);
while (t--){
scanf("%d",&n);
printf("%d\n",s[n]);
} }

百度 an - an-1 = n-1 就可以知道通项公式

然后 用公式算

#include<bits/stdc++.h>
using namespace std; int main ()
{
int t,n;
scanf("%d",&t);
while (t--){
scanf("%d",&n);
int t = sqrt(*n-);
if(t * (t+) == *n-)
printf("1\n");
else
printf("0\n");
}
}

51NOD 1087 1 10 100 1000的更多相关文章

  1. 51nod 1087 1 10 100 1000【打表】

    题目来源: Ural 1209 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题  收藏  关注 1,10,100,1000...组成序列1101001000...,求 ...

  2. 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 ...

  3. 1087 1 10 100 1000(打表 set 数学)

    1087 1 10 100 1000 题目来源: Ural 1209 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题  收藏  关注 1,10,100,1000... ...

  4. 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 ...

  5. Timus - 1209 - 1, 10, 100, 1000...

    先上题目: 1209. 1, 10, 100, 1000... Time limit: 1.0 secondMemory limit: 64 MB Let's consider an infinite ...

  6. [51NOD1087]1 10 100 1000(规律,二分)

    题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 用高中的数列知识就可以推出公式,不难发现f(n)=f(n ...

  7. 背水一战 Windows 10 (100) - 应用间通信: 分享

    [源码下载] 背水一战 Windows 10 (100) - 应用间通信: 分享 作者:webabcd 介绍背水一战 Windows 10 之 应用间通信 分享 示例1.本例用于演示如何开发一个分享的 ...

  8. 用js实现随机选取10–100之间的10个数字,存入一个数组,并排序

    var iArray = []; function getRandom(istart, iend) { var iChoice = iend - istart + 1; //加1是为了取到100 va ...

  9. ResourceWarning: unclosed <socket.socket fd=864, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.100.x.x', 37321), raddr=('10.1.x.x', 8500)>解决办法

    将代码封装,并使用unittest调用时,返回如下警告: C:\python3.6\lib\collections\__init__.py:431: ResourceWarning: unclosed ...

随机推荐

  1. 对SQL SERVER数据类型理解最好的一篇文章

    字符串前加N SQL SERVER中生成的语句中,字符串前加N,N 前缀必须是大写字母,是Unicode编码的意思. 一般来说,英文字符是一个字节组成,但是国际上的字太多了,因此就用两个字节来表示字符 ...

  2. JSON Web Token – 在 Web 应用间安全地传递信息

    出处:子回 使用 JWT 令牌和 Spring Security 来实现身份验证 八幅漫画理解使用JSON Web Token设计单点登录系统

  3. 论存储IOPS和Throughput吞吐量之间的关系

    论存储IOPS和Throughput吞吐量之间的关系 http://www.csdn.net/article/2015-01-14/2823552 IOPS和Throughput吞吐量两个参数是衡量存 ...

  4. 006-spring cloud gateway-GatewayAutoConfiguration核心配置-GatewayProperties初始化加载、Route初始化加载

    一.GatewayProperties 1.1.在GatewayAutoConfiguration中加载 在Spring-Cloud-Gateway初始化时,同时GatewayAutoConfigur ...

  5. orm之路由层

    一.简单配置 1.参数 第一个参数是正则表达式(如果要精准匹配:‘^publish/$’),或者加斜杠('^publish/') 第二个参数是视图函数(不要加括号) urlpatterns = [ u ...

  6. spring-data-mongodb关于id的坑

    有如下Mongo记录: 在Java中对应2个类来表示此结构: public class SG_IMAGERELATION { @Id private String id; private int gi ...

  7. BCB 按钮添加背景图

    使用控件:TBitBtn 位于 Additional分类 属性:GlyPh

  8. Kintone学习

    kintone JavaScript编码指南 编码的注意地方: 文字编码 使用 utf-8

  9. Q-learning简明实例

    本文是对 http://mnemstudio.org/path-finding-q-learning-tutorial.htm 的翻译,共分两部分,第一部分为中文翻译,第二部分为英文原文.翻译时为方便 ...

  10. IO(File)

    1. 一个File类的对象,表示了磁盘上的文件或目录 2. File类提供了与平台无关的方法来对磁盘上的文件或目录进行操作 3. File对象可用来获取或处理与磁盘文件相关的信息,如:权限,时间,日期 ...