题解分享
题解分享简介
握手问题(结果填空) - 题解
```
#include <bits/stdc++.h>
using namespace std;
#define N 55
int a[N];
int main() {
a[1] = 0;
for (int i = 2; i <= 50; ++i)
a[i] = a[i - 1] + (i - 1);
cout << (a[50] - a[7]) << endl;
return 0;
}
```
1
0
2
2
握手问题(结果填空) - 题解
49 + 48 + 47 + ...... + 1 = 1225;
6 + 5 + 7 + ...... + 1 = 21;
1225 - 21 = 1204
1
0
1
6
握手问题(结果填空) - 题解
include
int main()
{
int n=49,sum=0,m=6;
while(n>0)
{
if(m>0)
{
sum=sum+n-m;
n--;
m--;
}
else
{
sum+=n;
n--;
}
}
printf("%d\n",sum);
}
0
0
0
7
握手问题(结果填空) - 题解
```
#include
using namespace std;
#include <numeric>
typedef long long int ll;
int main() {
int i, j,n=0;
for(i=1;i<=50;i++)
for (j = 1; j <= 50; j++) {
if ((i>=1&&i<=7&&j>=1&&j<=7)||i==j)continue;
n++;
}
cout << n / 2;
return 0;
}
```
查看全文
0
0
0
3



