题解:P11143 「SFMOI Round I」Strange Cake Game
简单博弈,划分的面积肯定是越大越好,
所以从原点走一条折线到终点肯定最优,判断是否蛋糕在折线上方。
AC代码:
#include<bits/stdc++.h>
using namespace std;
#define int long long
int rd() {
int x = 0, w = 1;
char ch = 0;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * w;
}
void wt(int x) {
static int sta[35];
int f = 1;
if(x < 0) f = -1,x *= f;
int top = 0;
do {
sta[top++] = x % 10, x /= 10;
} while (x);
if(f == -1) putchar('-');
while (top) putchar(sta[--top] + 48);
}
const int N = 2e5+5;
int n,m,k;
signed main() {
n = rd(),m = rd();
k = rd();
int ans = 0;
for(int i = 1;i<=k;i++) {
int x = rd(),y = rd();
if(x > y) ans++;
}
wt(k - ans);
return 0;
}