Initial commit

This commit is contained in:
2025-03-14 22:39:32 +08:00
commit 7b1e0f329e
38 changed files with 1153 additions and 0 deletions

19
15lanqiao/test2.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include<bits/stdc++.h>
using namespace std;
int main() {
int x = 343720, y = 233333, dx = 15, dy = 17;
int p = y*dx, q = x*dy;
int g = gcd(p, q);
p /= g, q /= g;
int t = 2*p*x / dx;
double ans = t * (sqrt(15*15 + 17*17));
printf("%.2lf\n", ans);
return 0;
}
/*
思路:针对前进的方向进行分解分为x方向的运动和y方向的运动假设x方向走了p个来回y反向走了q个来回
经过了时间t小球第一次回到原点则t*dx=2px,t*dy=2qy结合1式/2式得p/q=y/x*dx/dy
利用gcd对分式p,q进行约分进而得到约分后的p,q
则时间 t = 2px/dx, 总路程 = t * sqrt(15*15 + 17*17)
*/