-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce26cce
Showing
6 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# 祝考试顺利通过! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include<stdio.h> | ||
int gcd(int a,int b){ | ||
return b>0?gcd(b,a%b):a; | ||
} | ||
int main(){ | ||
int t; | ||
scanf("%d",&t); | ||
while(t--){ | ||
int n,m; | ||
scanf("%d %d",&n,&m); | ||
if(m==0){ | ||
printf("0\n"); | ||
}else{ | ||
if(n==m){ | ||
printf("1\n"); | ||
}else{ | ||
if(m<3){ | ||
printf("0\n"); | ||
}else{ | ||
int a=m*(m-1)*(m-2); | ||
int b=n*(n-1)*(n-2); | ||
int ab_gcd=gcd(a,b); | ||
a/=ab_gcd; | ||
b/=ab_gcd; | ||
printf("%d/%d\n",a,b); | ||
} | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
int main(){ | ||
int t; | ||
scanf("%d",&t); | ||
while(t--){ | ||
int a,b,c; | ||
scanf("%d %d %d",&a,&b,&c); | ||
if(a==b||a==c||b==c){ | ||
printf("Yes\n"); | ||
}else if(a+b==c||a+c==b||b+c==a){ | ||
printf("Yes\n"); | ||
}else if(a-b==abs(c)||a-c==abs(b)||b-a==abs(c)||b-c==abs(a)||c-a==abs(b)||c-b==abs(a)){ | ||
printf("Yes\n"); | ||
}else if(a/b==c||a/c==b||b/c==a||b/a==c||c/a==b||c/b==a){ | ||
printf("Yes\n"); | ||
}else if(a*b==c||a*c==b||b*c==a){ | ||
printf("Yes\n"); | ||
}else{ | ||
printf("No\n"); | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include<stdio.h> | ||
int main(){ | ||
int t; | ||
scanf("%d",&t); | ||
while(t--){ | ||
int n; | ||
scanf("%d",&n); | ||
double w1=1,d1=1,l1=1; | ||
while(n--){ | ||
double w,d,l; | ||
scanf("%lf %lf %lf",&w,&d,&l); | ||
if(w>=w1){ | ||
w1=w; | ||
} | ||
if(d>=d1){ | ||
d1=d; | ||
} | ||
if(l>=l1){ | ||
l1=l; | ||
} | ||
} | ||
double sum=1/w1+1/d1+1/l1; | ||
if(sum<1){ | ||
printf("Yes\n"); | ||
}else{ | ||
printf("No\n"); | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
#include<stdbool.h> | ||
#define N 1000010 | ||
bool is_q[N]; | ||
|
||
//把完全平方数存进数组里面,用数组下标查询只需要 O(1) 的时间 | ||
void init(){ | ||
for(int i=1;i<=1000;i++){ | ||
is_q[i*i]=true; | ||
} | ||
} | ||
|
||
int main(){ | ||
init(); | ||
int t; | ||
scanf("%d",&t); | ||
while(t--){ | ||
int n; | ||
scanf("%d",&n); | ||
int ans=0; | ||
for(int i=1;i<=1000;i++){ | ||
for(int j=1;j<=i;j++){ | ||
if(i*i+j*j<n){ | ||
int k=n-i*i-j*j; | ||
if(is_q[k]){ | ||
if(sqrt(k)<=j){ | ||
ans++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
printf("%d\n",ans); | ||
} | ||
return 0; | ||
} |