![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int X1, X2, X3; 6 scanf("%d %d %d", &X1, &X2, &X3); 7 printf("%d\n", 4 * (int)(sqrt(1.0 * X1 * X2 / X3 + 0.5) + sqrt(1.0 * X1 * X3 / X2 + 0.5) + sqrt(1.0 * X2 * X3 / X1 + 0.5))); 8 return 0; 9 }
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2e5 + 10; 4 char s[maxn], t[maxn]; 5 int a[maxn], r[66]; 6 7 int main(){ 8 scanf("%s %s", s + 1, t + 1); 9 int ls = strlen(s + 1), lt = strlen(t + 1); 10 int p = 1, ok = 1; 11 for(int i = 1; i <= ls; ++i) { 12 if (p <= lt && s[i] == t[p]) ++p; 13 a[i] = p - 1; 14 } 15 p = lt; 16 for(int i = ls; i >= 1; --i){ 17 if(p >= 1 && s[i] == t[p]){ 18 r[s[i]-'a'] = p; 19 p--; 20 } 21 if(r[s[i]-'a'] && r[s[i]-'a'] <= a[i-1] + 1) continue; 22 ok = 0; 23 break; 24 } 25 puts(ok ? "Yes" : "No"); 26 return 0; 27 }
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const LL mod = 1e9 + 7; 5 LL a[2222]; 6 7 LL qpow(LL a, LL b) { 8 LL ret = 1LL; 9 while (b) { 10 if (b & 1) ret = ret * a % mod; 11 a = a * a % mod; 12 b >>= 1; 13 } 14 return ret; 15 } 16 17 LL inv(LL x) { 18 return qpow(x, mod - 2); 19 } 20 21 int main() { 22 int n, k; 23 scanf("%d %d", &n, &k); 24 for (int i = 1; i <= n; ++i) { 25 scanf("%lld", a + i); 26 LL ans = 0, tmp = 1; 27 for (int j = i; j >= 1; --j) { 28 ans = (ans + a[j] * tmp) % mod; 29 tmp = tmp * (k - j + i) % mod * inv(i - j + 1) % mod; 30 } 31 printf("%lld%c", k ? ans : a[i], i == n ? '\n' : ' '); 32 } 33 return 0; 34 }
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 const double pi = acos(-1); 4 5 int main(){ 6 int T; 7 scanf("%d", &T); 8 while(T--){ 9 double lat1, lng1, lat2, lng2, r = 6371009; 10 scanf("%lf %lf %lf %lf", &lat1, &lng1, &lat2, &lng2); 11 lat1 = lat1 / 180 * pi; 12 lat2 = lat2 / 180 * pi; 13 lng1 = lng1 / 180 * pi; 14 lng2 = lng2 / 180 * pi; 15 double x1 = r * cos(lat1) * sin(lng1), y1 = r * cos(lat1) * cos(lng1), z1 = r * sin(lat1); 16 double x2 = r * cos(lat2) * sin(lng2), y2 = r * cos(lat2) * cos(lng2), z2 = r * sin(lat2); 17 double x = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)); 18 double c = acos((2 * r * r - x * x) / 2 / r / r); 19 double d = c * r - x; 20 printf("%.0f\n", d); 21 } 22 return 0; 23 }
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef pair<int, int> pii; 4 const int maxn = 1e5 + 10; 5 const int INF = 1e9; 6 vector<pii> G[maxn]; 7 int n, p[11]; 8 9 int dis[maxn], vis[maxn]; 10 void dijkstra(int s){ 11 for(int i = 0; i <= n; ++i) dis[i] = INF, vis[i] = 0; 12 dis[s] = 0; 13 priority_queue<pii> pq; 14 pq.push(pii(0, s)); 15 while(!pq.empty()){ 16 int x = pq.top().second; pq.pop(); 17 if(vis[x]) continue; 18 vis[x] = 1; 19 for(int i = 0; i < G[x].size(); ++i){ 20 int to = G[x][i].first, d = G[x][i].second; 21 if(dis[to] > dis[x] + d) { 22 dis[to] = dis[x] + d; 23 pq.push(pii(-dis[to], to)); 24 } 25 } 26 } 27 } 28 29 int d[11][11], f[1<<10][10]; 30 int main() { 31 int T; 32 scanf("%d", &T); 33 while (T--) { 34 int m, S; 35 scanf("%d %d", &n, &m); 36 for (int i = 0; i <= n; ++i) G[i].clear(); 37 for (int i = 1; i <= m; ++i) { 38 int x, y, z; 39 scanf("%d %d %d", &x, &y, &z); 40 G[x].push_back(pii(y, z)); 41 G[y].push_back(pii(x, z)); 42 } 43 scanf("%d", &S); 44 for(int i = 0; i < (1 <<S); ++i) 45 for(int j = 0; j < S; ++j) 46 f[i][j] = INF; 47 for (int i = 1; i <= S; ++i) scanf("%d", p + i); 48 for (int i = 1; i <= S; ++i) { 49 dijkstra(p[i]); 50 f[1<<(i-1)][i-1] = d[0][i] = d[i][0] = dis[0]; 51 for (int j = 1; j <= i; ++j) { 52 d[i][j] = d[j][i] = dis[p[j]]; 53 } 54 } 55 for(int i = 0; i < (1 << S); ++i){ 56 for(int j = 0; j < S; ++j){ 57 if(f[i][j] == INF) continue; 58 for(int k = 0; k < S; ++k){ 59 if(i & (1 << k)) continue; 60 if(d[j+1][k+1] == INF) continue; 61 f[i^(1<<k)][k] = min(f[i^(1<<k)][k], f[i][j] + d[j+1][k+1]); 62 } 63 } 64 } 65 int ans = INF; 66 for(int i = 0; i < S; ++i){ 67 ans = min(ans, f[(1<<S)-1][i] + d[0][i+1]); 68 } 69 printf("%d\n", ans); 70 } 71 return 0; 72 }
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 5e5 + 10; 4 char s[maxn], t[maxn]; 5 6 bool check(int x, int lt){ 7 for(int i = 1; i <= lt; ++i) 8 if(s[x+i] != t[i]) return false; 9 return true; 10 } 11 12 int main(){ 13 int T; 14 scanf("%d", &T); 15 while(T--){ 16 scanf("%s %s", s + 1, t + 1); 17 int ls = strlen(s + 1), lt = strlen(t + 1), ok = 0; 18 if(ls == lt){ 19 if(check(0, lt)) ok = 1; 20 } 21 else if((ls - lt) % 2 == 1) { 22 if (check((ls - lt - 1) / 2, lt) && check((ls - lt - 1) / 2 + 1, lt)) ok = 1; 23 } 24 else { 25 if ((check((ls - lt - 1) / 2, lt) || check((ls - lt - 1) / 2 + 1, lt)) && (check((ls - lt - 1) / 2 + 1, lt) || check((ls - lt - 1) / 2 + 2, lt))) ok = 1; 26 } 27 puts(ok ? "Alice" : "Bob"); 28 } 29 return 0; 30 }