题目传送门

 /*
暴力:O (n^2)
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f; int main(void) //Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II
{
int n;
while (scanf ("%d", &n) == )
{
int ans = ;
for (int i=; i<=n; ++i)
{
for (int j=i; j<=n; ++j)
{
if (i * i + j * j > n * n) break;
int c = sqrt (i * i + j * j);
if (c <= n && c * c == i * i + j * j) ans++;
}
} printf ("%d\n", ans);
} return ;
}

暴力 Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II的更多相关文章

  1. Codeforces Round #368 (Div. 2) C. Pythagorean Triples(数学)

    Pythagorean Triples 题目链接: http://codeforces.com/contest/707/problem/C Description Katya studies in a ...

  2. 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog

    题目传送门 /* 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 详细解释:ht ...

  3. 暴力 Codeforces Round #305 (Div. 2) B. Mike and Fun

    题目传送门 /* 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) */ #include <cstdio> #include <cstring> #includ ...

  4. 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight

    题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...

  5. 二分查找/暴力 Codeforces Round #166 (Div. 2) B. Prime Matrix

    题目传送门 /* 二分查找/暴力:先埃氏筛选预处理,然后暴力对于每一行每一列的不是素数的二分查找最近的素数,更新最小值 */ #include <cstdio> #include < ...

  6. 构造+暴力 Codeforces Round #283 (Div. 2) B. Secret Combination

    题目传送门 /* 构造+暴力:按照题目意思,只要10次加1就变回原来的数字,暴力枚举所有数字,string大法好! */ /************************************** ...

  7. Codeforces Round #183 (Div. 2)

    A. Pythagorean Theorem II 暴力,\(O(n^2)\). B. Calendar 每个日期计算到0年1月1日的天数,相当于转化成前缀和形式. 闰年数计算\[\lfloor\fr ...

  8. Codeforces Round #368 (Div. 2) C. Pythagorean Triples 数学

    C. Pythagorean Triples 题目连接: http://www.codeforces.com/contest/707/problem/C Description Katya studi ...

  9. Codeforces Round #360 (Div. 1) D. Dividing Kingdom II 暴力并查集

    D. Dividing Kingdom II 题目连接: http://www.codeforces.com/contest/687/problem/D Description Long time a ...

随机推荐

  1. zookeeper客户端

    查看具体结点信息 bash zkServer.sh status 查看哪个结点被选作leader或者followerecho stat|nc 127.0.0.1 2181 测试是否启动了该Server ...

  2. 进程(WINAPI),遍历并查找树状的进程信息,实现控制系统进程

    #include <TlHelp32.h> //检索系统全部进程 void showall() { PROCESSENTRY32 pe32 = {0}; pe32.dwSize = siz ...

  3. php.ini中extension默许的地址到底在哪里设置的

    原文: http://www.myexception.cn/php/1436096.html ----------------------------------------------------- ...

  4. Office WORD如何输入长下划线

    选中一段文字,点击下划线按钮,可以添加下划线   同样,选中一段空格,点下划线,也可以添加下划线    

  5. leetcode ----Trie/stack专题

    一:Implement Trie (Prefix Tree) 题目: Implement a trie with insert, search, and startsWith methods. Not ...

  6. 编程之美 之 让CPU占用率听你指挥

    昨天在bbs上淘到了这本编程之美.顺手刷了第一章,很有意思.第一章的要求是要控制CPU曲线,绘制出对应的形状. 拿到这个问题,我的第一反应是, 是不是有这么一个API,能在任务管理器上的对应区域直接绘 ...

  7. Android 性能优化探究

    使用ViewStub动态载入布局.避免一些不常常的视图长期握住引用: ViewStub的一些特点: 1. ViewStub仅仅能Inflate一次,之后ViewStub对象被置空:某个被ViewStu ...

  8. 关于mybatis的 insert into select 命令未结束问题

    关于mybatis的 insert into select 命令未结束问题,最后以为是sql写错了,可是,在plsql运行又没问题.最后还是解决这个问题. 是设置问题. ### Cause: java ...

  9. WAMP的端口修改

    wamp集成了开源的利器mysql+apache+php,真的是有越来越火的趋势了,可是有些人,安装php的集成开发环境WAMP的时候,出现端口被占用了,无法连接服务器的时候, 这时,如果要修改WAM ...

  10. docker大全集

    1,什么是docker docker 最初是dotCloud公司创始人 Solomon Hykes 在法国期间发起的一个公司内部醒目,于 2013年 3 月以 Apache 2.0 授权协议开源, 主 ...