暴力求解蓝桥杯最大降雨量
#include <stdio.h>
#include <algorithm>
using namespace std;
#include <stdlib.h>
int a[50];
int b[7];
int main()
{
int zws_max = 0;
while(true)
{
for(int i=1;i<=49;i++)
{
a[i] = i;
}
int N = rand()%100000;
int n=0;
while(n<N)
{
int x = rand()%49+1;
int y = rand()%49+1;
int temp = a[x];
a[x] = a[y];
a[y] = temp;
n++;
}
int k=0;
for(int i=0;i<=42;i+=7)
{
sort(a+i,a+i+7);
b[k] = a[i+3];
k++;
}
sort(b,b+7);
int zws = b[3];
if(zws_max<zws)
{
zws_max = zws;
printf("*****%d******\n",zws_max);
}
}
return 0;
}