# 乘积尾零

5650 4542 3554 473 946 4114 3871 9073 90 4329

2758 7949 6113 5659 5245 7432 3051 4434 6704 3594

9937 1173 6866 3397 4759 7557 3070 2287 1453 9899

1486 5722 3135 1170 4014 5510 5120 729 2880 9019

2049 698 4582 4346 4427 646 9742 7340 1230 7683

5693 7015 6887 7381 4172 4341 2909 2027 7355 5649

6701 6645 1671 5978 2704 9926 295 3125 3878 6785

2066 4247 4800 1578 6652 4616 1113 6205 3264 2915

3966 5291 2904 1285 2193 1428 2265 8730 9436 7074

689 5510 8243 6114 337 4096 8199 7313 3685 211

#include <stdio.h>
int main(void)
{
int a[100] = {5650,4542,3554,473,946,4114,3871,9073,90,4329,2758,7949,6113,5659,5245,7432,3051,4434,6704,3594,9937,1173,6866,3397,4759,7557,3070,2287,1453,9899,1486,5722,3135,1170,4014,5510,5120,729,2880,9019,2049,698,4582,4346,4427,646,9742,7340,1230,7683,5693,7015,6887,7381,4172,4341,2909,2027,7355,5649,6701,6645,1671,5978,2704,9926,295,3125,3878,6785,2066,4247,4800,1578,6652,4616,1113,6205,3264,2915,3966,5291,2904,1285,2193,1428,2265,8730,9436,7074,689,5510,8243,6114,337,4096,8199,7313,3685,211};
int b[2] = {0}, t;
for(int i = 0; i < 100; i ++)
{
t = a[i];
for(; !(t & 1); t /= 2)
b[0] ++;
for(; t % 5 == 0; t /= 5)
b[1] ++;
}
if(b[0] > b[1]) printf("%d",b[1]);
else printf("%d",b[0]);
return 0;
}

# 全球变暖

.......

.##....

.##....

....##.

..####.

...###.

.......

.......

.......

.......

.......

....#..

.......

.......

7
.......
.##....
.##....
....##.
..####.
...###.
.......

1

#include <iostream>
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 1000 + 10;
int n;
typedef pair<int,int> PII;
PII q[N * N];
bool st[N][N];
char g[N][N];
int dx[4] = {-1, 0, 1, 0},dy[4] = {0, 1, 0, -1};
void bfs(int sx, int sy, int &tl, int &bd)
{
int tt = 0,hh = 0;
st[sx][sy] = true;
q[0] = {sx, sy};
while(hh <= tt)
{
PII t = q[hh ++];
tl ++;
bool is_bd = false;
for(int i = 0; i < 4; i ++)
{
int x = t.x + dx[i],y = t.y + dy[i];
if(x < 0 || x >= n || y < 0 || y >= n || st[x][y]) continue;
if(g[x][y] == '.')
{
is_bd = true;
continue;
}
st[x][y] = true;
q[++ tt] = {x, y};
}
if(is_bd) bd++;
}
}
int main(){
cin >> n;
for(int i = 0;i < n;i++) cin >> g[i];
int cnt  = 0;
for(int i = 0;i < n;i++)
for(int j = 0;j < n;j++)
{
if(!st[i][j] && g[i][j] == '#')
{
int tl = 0,bd = 0;
bfs(i, j, tl, bd);
if(tl == bd) cnt ++;
}
}
cout << cnt << endl;
return 0;
}

# 第几天

2000年的1月1日，是那一年的第1天。

#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string.h>
using namespace std;
int main()
{
cout << 125 << endl;
return 0;
}

# 明码

16点阵的字库把每个汉字看成是16x16个像素信息。并把这些信息记录在字节中。

第1字节，第2字节

第3字节，第4字节

....

第31字节, 第32字节

4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0
16 64 16 64 34 68 127 126 66 -124 67 4 66 4 66 -124 126 100 66 36 66 4 66 4 66 4 126 4 66 40 0 16
4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0
0 -128 64 -128 48 -128 17 8 1 -4 2 8 8 80 16 64 32 64 -32 64 32 -96 32 -96 33 16 34 8 36 14 40 4
4 0 3 0 1 0 0 4 -1 -2 4 0 4 16 7 -8 4 16 4 16 4 16 8 16 8 16 16 16 32 -96 64 64
16 64 20 72 62 -4 73 32 5 16 1 0 63 -8 1 0 -1 -2 0 64 0 80 63 -8 8 64 4 64 1 64 0 -128
0 16 63 -8 1 0 1 0 1 0 1 4 -1 -2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 5 0 2 0
2 0 2 0 7 -16 8 32 24 64 37 -128 2 -128 12 -128 113 -4 2 8 12 16 18 32 33 -64 1 0 14 0 112 0
1 0 1 0 1 0 9 32 9 16 17 12 17 4 33 16 65 16 1 32 1 64 0 -128 1 0 2 0 12 0 112 0
0 0 0 0 7 -16 24 24 48 12 56 12 0 56 0 -32 0 -64 0 -128 0 0 0 0 1 -128 3 -64 1 -128 0 0

（九的九次方）

# 测试次数

x星球的居民脾气不太好，但好在他们生气的时候唯一的异常举动是：摔手机。

x星球有很多高耸入云的高塔，刚好可以用来做耐摔测试。

#include <bits/stdc++.h>
using namespace std;
int Func(int K, int N) {
vector<int> vec(K + 1, 0);
int m = 0;
while (vec[K] < N) {
++m;
for (int k = K; k > 0; --k) {
vec[k] = vec[k - 1] + vec[k] + 1;
}
}
return m;
}
int main()
{
cout << Func(3, 1000);
return 0;
}

# 递增三元组

A = [A1, A2, ... AN],

B = [B1, B2, ... BN],

C = [C1, C2, ... CN]，

1. 1 <= i, j, k <= N

2. Ai < Bj < Ck

1 <= N <= 100000 0 <= Ai, Bi, Ci <= 100000

3
1 1 1
2 2 2
3 3 3

27

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn],c[maxn];
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
for (int i = 0; i < n; i++) scanf("%d", &b[i]);
for (int i = 0; i < n; i++) scanf("%d", &c[i]);
sort(a, a + n);
sort(b, b + n);
sort(c, c + n);
ll ans = 0;
for (int i = 0; i < n; i++)
{
ll x = lower_bound(a, a + n, b[i]) - a;
ll y = n - (upper_bound(c, c + n, b[i]) - c);
ans += y * x;
}
cout << ans << endl;
}

# 螺旋折线

X和Y，数据在int范围以内。

0 1

3

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
long long X,Y;
cin >> X >> Y;
long long  n = max(abs(X), abs(Y));//获取正方形
long long t ;  //判断（X,Y）与(-n,-n)的距离
if(Y == -n)
{  //底边
t =   X-(-n);
}else if(X==n )
{//在右边
t = 2 * n + Y - (-n);
}else if(Y == n)
{  //上边
t = 4 * n + (n - X);
}else{  //左边
t = 6 * n + n - Y;
}
cout << 4 * n * (n + 1) - t;
return 0;
}

# 日志统计

1 <= K <= N <= 100000 0 <= ts <= 100000 0 <= id <= 100000

7 10 2
0 1
0 10
10 10
10 1
9 1
100 3
100 3

1
3

#include<iostream>
#include<string>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string.h>
using namespace std;
int cpp[100005];
int bqq[100005];
struct tie
{
int id=-1;
int t=-1;
}arr[100005],a;
int cmp(tie x, tie y) { return x.t < y.t; }
int main()
{
int n, d, k;
scanf("%d%d%d", &n, &d, &k);
for (int i = 0;i < n;i++)
{
scanf("%d%d", &arr[i].t, &arr[i].id);
}
sort(arr, arr + n,cmp);
for (int i = 0, j = 0;i < n;i++) {
bqq[arr[i].id]++;
while (arr[i].t - arr[j].t >= d) {
bqq[arr[j].id]--;
j++;
}
if (bqq[arr[i].id] >= k)
cpp[arr[i].id] = 1;
}
for (int i = 0;i < 100005;i++)
{
if (cpp[i] == 1)
{
cout << i << endl;
}
}
return 0;
}

|
2月前

33 2
|
2月前
|

63 2
|
2月前
|

52 1
|
11月前

72 0
|
11月前
|
API

36 0
|
11月前

33 0
|
11月前

52 0
|
11月前

80 0
|
11月前
|

70 0
|
11月前
|
Java

67 0