1 条题解
-
0
C++ :
#include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> using namespace std; struct P { int x,y; }a[1005]; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int t; scanf("%d",&t); while(t--) { int n,S; scanf("%d%d",&n,&S); for(int i=0;i<n;i++) scanf("%d%d",&a[i].x,&a[i].y); int sum=1; for(int i=0;i<n;i++) { int res=S; int temp=1; for(int j=i+1;j<n;j++) { int p=(a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y); if(res>=p) { res-=p; temp++; } else break; } sum=max(sum,temp); } printf("%d\n",sum); } }
- 1
信息
- ID
- 3426
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者