Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
t-zs committed Sep 15, 2024
0 parents commit ce26cce
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 祝考试顺利通过!
31 changes: 31 additions & 0 deletions 作业0x04-数学,GCD/A+B III.cpp
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.
24 changes: 24 additions & 0 deletions 简单数学2/3个数.cpp
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;
}
30 changes: 30 additions & 0 deletions 简单数学2/世界杯.cpp
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;
}
37 changes: 37 additions & 0 deletions 简单数学2/等式.cpp
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;
}

0 comments on commit ce26cce

Please sign in to comment.