题意:
给l到r,x到y,判断有没有两个数[l,r]/[x,y]==k的。
point:
说他水吧,死的很惨,说他不水吧,的确很水。
死在ll上面和莫名其妙的把分子分母搞反了。
不知道为什么当时考虑不到ll。
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;
#define LL long long
int main()
{
LL l, r, x, y;
LL k;
scanf("%lld %lld %lld %lld %lld", &l, &r, &x, &y, &k);
LL flag=0;
if(1.0*r/x<1.0*k||1.0*l/y>1.0*k)
{
printf("NO\n");
return 0;
}
for(LL i=x;i<=y;i++)
{
if(i*k>=l&&i*k<=r)
{
flag=1;
break;
}
}
if(flag) printf("YES\n");
else printf("NO\n");
}
题意:
直接看图,求绿色的圆的数量。
POINT:
随便比较一下。没坑点
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <math.h>
using namespace std;
int main()
{
double r,d;
cin>>r>>d;
int n;
cin>>n;
int ans=0;
for(int i=1;i<=n;i++)
{
double x,y,rr;
cin>>x>>y>>rr;
double ll=sqrt(x*x+y*y);
if(ll+rr>r) continue;
if(ll-rr<r-d) continue;
ans++;
}
printf("%d\n",ans);
}