coderforce 304a - Pythagorean Theorem II
来源:互联网 发布:罗技宏编程下载 编辑:程序博客网 时间:2024/05/20 17:10
暴力,枚举a,b的值,判断c的大小。。。。。。。。。。。
但是为什么我的非暴力的代码就是不对呢????
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define ls rt<<1
#define rs ls1
#define lson l,mid,ls
#define rson mid+1,r,rs
#define middle (l+r)>>1
#define eps (1e-9)
#define type int
#define clr_all(x,c) memset(x,c,sizeof(x))
#define clr(x,c,n) memset(x,c,sizeof(x[0])*(n+1))
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define M 200000+5
int main(){
int n,a,b,cnt,x,c;
scanf("%d",&n);
cnt=0;
for(a=1;a<=n;a++){
for(b=a;b<=n;b++){
c=a*a+b*b;
if(c>n*n)continue;
x=(int)sqrt(c*1.0);
if(x*x==c)cnt++;
}
}
printf("%d\n",cnt);
return 0;
}
- coderforce 304a - Pythagorean Theorem II
- A. Pythagorean Theorem II
- A. Pythagorean Theorem II
- codeforces 304A. Pythagorean Theorem II
- CodeForces 304A Pythagorean Theorem II
- cf 304A Pythagorean Theorem II
- CF 304A(Pythagorean Theorem II-n内勾股数)
- CodeForces 304A Pythagorean Theorem II 【基础】【暴力】
- Pythagorean Theorem II
- Pythagorean Theorem II
- A. Pythagorean Theorem II(血的教训)
- codeforces 183(div2) A. Pythagorean Theorem II 枚举+二分查找
- Problem F Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II
- coderforce 2A-Winner
- coderforce 282A Bit++
- coderforce 306A Candies
- coderforce 527A Arrays
- coderforce 534A Exam
- 熬之滴水穿石:一切从windows编程开始(2)
- js正则表达式检查时间的合法性
- 从社会文化角度看软件从业者——读ESEM 2012 paper 有感
- javascipt正则表达式 验证邮箱与数字
- javascript检测浏览器的代码
- coderforce 304a - Pythagorean Theorem II
- poj3181 Dollar Dayz dp
- 《Head First 设计模式》读书笔记之1:设计模式入门(策略模式)
- 敏捷开发的26条至理名言
- 高仿Maxthon4的Win8风格的安装界面(附源码下载)
- Qt中添加背景图片的方法(转)
- 实验3 this指针、常量和静态成员和友元函数的使用
- joj 1008 Go hang a salami 回文判断
- 排序(hdu1106 strtok函数的使用)