/*可能有错,请见谅*/
第一题:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,M;
if (N > M)
{
cout << N;
}
else
{
cout << M;
}
return 0;
}
第二题:
#include <bits/stdc++.h>
using namespace std;
int n, cnt;
bool check(int a, int b, int c)
{
if (i >= j || j <= k || i <= k)
{
return false;
}
while (a > 0)
{
if (a % 10 == 3 || a % 10 == 7)
{
return false;
}
a /= 10;
}
while (b > 0)
{
if (b % 10 == 3 || b % 10 == 7)
{
return false;
}
b /= 10;
}
while (c > 0)
{
if (c % 10 == 3 || c % 10 == 7)
{
return false;
}
c /= 10;
}
return true;
}
int main()
{
cin >> n;
for (int i = 1; i <= n / 3; i++)
{
for (int j = i + 1; j <= n / 2; j++)
{
int k = n - i - j;
if (check(i, j, k))
{
cnt++;
}
}
}
cout << cnt << endl;
return 0;
}
第三题:
#include <bits/stdc++.h>
using namespace std;
int a, b;
int main()
{
cin >> a >> b;
for (int k = a * b; k >= 1; k--)
{
int flag = 0;
for (int i = 0; i < 100; i++)
{
int j = k - a * i;
if (j >= 0 && j % b == 0)
{
flag = 1;
break;
}
}
if (flag == 0)
{
cout << k << endl;
break;
}
}
return 0;
}
第四题:
#include <bits/stdc++.h>
using namespace std;
struct node
{
int w, h;
}
a[110];
int n, k, sum, maxn;
bool check(int x)
{
int s = 0;
for (int i = 1; i <= n; i++)
{
s += (a[i].w * a[i].h) / (x * x);
}
return s >= k;
}
int main()
{
cin >> n >> k;
for (int i = 1; i <= n; i++)
{
cin >> a[i].w >> a[i].h;
sum += a[i].w * a[i].h;
saxn = max(maxn, min(a[i].w, a[i].h));
}
if (sum < k)
{
cout << -1 << endl;
return 0;
}
int l = 1, r = maxn, mid;
while(l < r - 1)
{
mid = (l + r) / 2;
if (check(mid))
{
l = mid;
}
else
{
r = mid;
}
}
if (check(r))
{
cout << r << endl;
}
cout << l << endl;
return 0;
}