# 2019.3.14解题报告&补题报告

0
11

### A题

``` 1 #include<bits/stdc++.h>
2
3 #define vint vector<int>
4 #define vstr vector<string>
5 #define vll vector<long long>
6 #define ll long long
7 #define ull unsigned long long
8 #define pf printf
9 #define sf scanf
10 #define sfd(n) scanf("%d", &n)
11 #define sflf(n) scanf("%lf", &n)
12 #define sfll(n) scanf("%lld", &n)
13 #define pfd(n) printf("%d", n)
14 #define pflf(n) printf("%lf", n)
15 #define pfll(n) printf("%lld", n)
16 #define pft    printf("\t")
17 #define pfn printf("\n")
18 #define pfk printf(" ")
19 #define PI 3.1415926
20 #define MAX 100000
21
22 using namespace std;
23
24 int n, m;
25 int a[105], b[105];
26
27 int main() {
28     cin >> n >> m;
29     int maxr = -1, maxc = -1;
30     for (int i = 1; i <= n; i++) {
31         cin >> a[i];
32         maxr = max(maxr, a[i]);
33     }
34     for (int i = 1; i <= m; i++) {
35         cin >> b[i];
36         maxc = max(maxc, b[i]);
37     }
38     if( maxr==maxc ) {
39         cout << "possible" << endl;
40     }else {
41         cout << "impossible" << endl;
42     }
43
44
45     return 0;
46 }```

### F题

• n是奇数：x可以取1，即n = 2*k+1, m = k+1;
• n是4的倍数：x取2，即n = 4*k+4, m = k+2;
• n%2==0&&n%4!=0: 无法满足式子；

``` 1 #include<bits/stdc++.h>
2
3 #define vint vector<int>
4 #define vstr vector<string>
5 #define vll vector<long long>
6 #define ll long long
7 #define ull unsigned long long
8 #define pf printf
9 #define sf scanf
10 #define sfd(n) scanf("%d", &n)
11 #define sflf(n) scanf("%lf", &n)
12 #define sfll(n) scanf("%lld", &n)
13 #define pfd(n) printf("%d", n)
14 #define pflf(n) printf("%lf", n)
15 #define pfll(n) printf("%lld", n)
16 #define pft    printf("\t")
17 #define pfn printf("\n")
18 #define pfk printf(" ")
19 #define PI 3.1415926
20 #define MAX 100000
21
22 using namespace std;
23
24 int main() {
25     ll n, m, k;
26     bool f = true;
27     cin >> n;
28     if( n%2!=0 ) {
29         k = (n-1)/2;
30         m = k+1;
31     }else if( n%4==0 ){
32         k = (n-4)/4;
33         m = k+2;
34     }else {
35         f = false;
36     }
37     if( f ) {
38         cout << m << " " << k;
39     }else {
40         pf("impossible");
41     }
42
43     return 0;
44 }```

### I题

sos保存前k项的平方和，sum保存后（n-k）项的和，

``` 1 #include<bits/stdc++.h>
2
3 #define vint vector<int>
4 #define vstr vector<string>
5 #define vll vector<long long>
6 #define ll long long
7 #define ull unsigned long long
8 #define pf printf
9 #define sf scanf
10 #define sfd(n) scanf("%d", &n)
11 #define sfc(n) scanf("%c", &n)
12 #define sflf(n) scanf("%lf", &n)
13 #define sfll(n) scanf("%lld", &n)
14 #define pfd(n) printf("%d", n)
15 #define pfc(n) printf("%c", n)
16 #define pflf(n) printf("%lf", n)
17 #define pfll(n) printf("%lld", n)
18 #define pft    printf("\t")
19 #define pfn printf("\n")
20 #define pfk printf(" ")
21 #define PI 3.1415926
22 #define MAX 100000
23
24 using namespace std;
25
26 int main() {
27     int n;
28     cin >> n;
29     int* num = new int[n];
30     cin >> num[0];
31     ll sos = num[0]*num[0], sum = 0, max = 0, ans;
32     for( int i=1; i<n; i++ ) {
33         cin >> num[i];
34         sum += num[i];
35     }
36     for( int k=1; k<n; k++ ) {
37         ans = sos*sum;
38         if( max<ans ) {
39             max = ans;
40         }
41         sos += num[k]*num[k];
42         sum -= num[k];
43     }
44     pfll(max);
45
46     return 0;
47 }```

<

0