1.答案:125
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
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m)
{
for(int i = 8; i >= 0; i--)
{
if(n >> i & 1)
cout<<'@';
else cout<<' ';
}
for(int i = 8; i >= 0; i--)
{
if(m >> i & 1)
cout<<'@';
else cout<<' ';
}
cout<<endl;
}
return 0;
}
答案:387420489
3.
分解质因数
对比2和5的数目谁小就是谁,因为只有2和5能组成尾0;
int data[105] ={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<bits/stdc++.h>
using namespace std;
const int N = 1e6+5;
int s[N];
void get_p(int n)
{
for(int i = 2; i <= n/i; i++)
{
while(n % i == 0)
{
n/=i;
s[i]++;
}
}
if(n != 1) s[n]++;
}
int main()
{
int n;
while(cin>>n)
{
get_p(n);
}
int ans = s[2] < s[5] ? s[2] : s[5];
cout<<ans<<endl;
return 0;
}
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
const int N = 10010;
int n;
int f[4][N];
int main() {
scanf("%d", &n);
memset(f, 0x3f, sizeof(f));
for (int i = 0; i <= n; i++)
f[1][i] = i;
for (int i = 2; i <= 3; i++) {
f[i][0] = 0;
int k = 1;
for (int j = 1; j <= n; j++) {
while (k < j && max(f[i - 1][k - 1], f[i][j - k]) >= max(f[i - 1][k], f[i][j - k - 1]))
k++;
f[i][j] = min(f[i][j], max(f[i - 1][k - 1], f[i][j - k]) + 1);
}
}
printf("%d\n", f[3][n]);
return 0;
}
答案19
6.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int A[N],B[N],C[N];
int main()
{
int n;
long long ans = 0;
cin>>n;
for(int i = 0; i < n; i++) cin>>A[i];
for(int i = 0; i < n; i++) cin>>B[i];
for(int i = 0; i < n; i++) cin>>C[i];
sort(A,A+n);
sort(B,B+n);
sort(C,C+n);
for(int i = 0; i < n; i++)
{
int pos = lower_bound(A,A+n,B[i]) - A;
int pos1 = upper_bound(C,C+n,B[i]) - C;
ans += (long long)(pos)*(long long)(n-pos1);
}
cout<<ans<<endl;
return 0;
}
7.螺旋折线以前写的
8.