文章

3

粉丝

0

获赞

1

访问

1.6k

头像
直线交点种类 题解:
P5300 北京大学2025年机试题
发布于 2026年7月
阅读数 558

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int maxPoints=n*(n-1)/2;
    vector<vector<bool>> dp(
        n+1,
        vector<bool>(maxPoints+1,false)
    );
    dp[0][0]=true;
    for(int used=0;used<n;used++){
        for(int points=0;points<=maxPoints;points++){
            if(!dp[used][points]){
                continue;
            }
            for(int k=1;used+k<=n;k++){
                int newPoints=points+used*k;
     ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发