腾讯笔试

todo

1
2
3
4
5
6
7

using namespace std;
int (){
unsigned long long n,m;
cin>>n>>m;
cout<<n/2*m<<endl;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>

using namespace std;
const int N = 1000;
const int MOD = (int) 1e9 + 7;
unsigned long long comb[N][N];

void init() {
for (int i = 0; i < N; i++) {
comb[i][0] = comb[i][i] = 1;
for (int j = 1; j < i; j++) {
comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
comb[i][j] %= MOD;
}
}
}

int () {
init();
int k;
int A, X, B, Y;
cin >> k >> A >> X >> B >> Y;
int n = k / A, m = k / B, res;
unsigned long long ans = 0;
for (int i = 0; i <= n && i <= X; ++i)
for (int j = 0; j <= m && j <= Y; ++j)
if (i * A + j * B == k)
ans = (ans + comb[X][i] * comb[Y][j] % MOD) % MOD;
cout << ans;
}

https://blog.csdn.net/ncut_nwpu/article/details/79849661

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<stdio.h>
void test(long long a[]){
printf("%dn",sizeof(a)/sizeof(long long));
}
int (){
long long a[]={2,345,2423,4,454};
printf("%dn",sizeof(a)/sizeof(long long));
test(a);
}
//结果 5 1

void test(int a[]){
printf("%dn",sizeof(a)/sizeof(int));
}
int (){
int a[]={2,345,2423,4,454};
printf("%dn",sizeof(a)/sizeof(int));
test(a);
}
//结果5 2
//因为以 longlong指针传入