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. Python学习方法(待补充)

    一.好思想总结: 1.一个东西,正在学会了,是需要能简单教会别人,才是真正的理解透彻了,要是讲不透彻,还是一知半解. 2.思路别人教不了你,学会简单处理任何问题,再复杂的东西,在我看来现实项目中,很多 ...

  2. js-jquery-Validate校验【一】

    一.导入 js 库 <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.j ...

  3. 解决PHPStorm经常卡顿现象 调整内存限制

    https://www.jisec.com/other/451.html 为什么调整内存? 最近发现PHPstorm在打开一些大点的js, html文件时,会非常的卡顿,这个主要的原因是因为设置的内存 ...

  4. bootstrap modal插件弹出窗口如何限制最大高度,并且在内容过多时可以滚动显示

    .modal-body{ max-height:400px; overflow-y:auto; } 只有在modal-body类上限制高度才能起作用,其他地方的限制均不起作用

  5. Gson的两种解析用法

    第一种. 常见的解析,直接将json字符串解析为对应的类. public JavaBean getJsonString(String jsonString) { Gson gson = new Gso ...

  6. SDUTOJ2465:其实玩游戏也得学程序(bfs+优先队列+回溯)

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2465 题目描述 由于前两次的打击,ZYJ同学不 ...

  7. iOS UI基础-4.0应用程序管理

    功能与界面 功能分析: 以九宫格的形式展示应用信息 点击下载按钮后,做出相应的操作 步骤分析: 加载应用信息 根据应用的个数创建对应的view 监听下载按钮点击 整个应用界面: 程序实现 思路 UI布 ...

  8. TraceSource记录程序日志

    1.配置文件 <system.diagnostics> <sources> <source name="TraceError" switchValue ...

  9. pdo sqlserver

    PHP代码如果想要用以上的方式兼容linux服务器和windows服务器,那么大概的示例代码是这样的. <?php header("Content-type: text/html; c ...

  10. Protobuffer简介c#

    一.Protobuffer和json深度对比 JSON相信大家都知道是什么东西,如果不知道,那可就真的OUT了,GOOGLE一下去.这里就不介绍啥的了. Protobuffer大家估计就很少听说了,但 ...