Loading

Loading

2019CCPC女生专场 VP记录

2019CCPC女生专场 VP记录

时间:2026/10/1

过题顺序:A->B->G(队友)->J->K(队友)

位置:银上(好像近期是打的最好的一场)

人员:我和LittleSue

A

比大小,纯水签到

#include<iostream>
using namespace std;
long long n;
long long a[100010];
double ans,tot;
int main()
{
	cin>>n;
	long long x=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		
		if(tot<100)
		{
			ans+=x;
			tot+=x;
		}else if(tot<150){
			ans+=x*0.8;
			tot+=x*0.8;
		}else if(tot<400){
			ans+=x*0.5;
			tot+=x*0.5;
		}else{
			ans+=x;
			tot+=x;
		}
		
	}
	
	printf("%.2lf",ans);
	return 0;
}

B

读题5分钟之后灵机一动,发现每个数输出其除以第一个约数就行了。好简单

#include<iostream>
using namespace std;
long long n,m;
int main()
{
	cin>>n;
	m=n*(n+1)/2;
	if(m%2==0)
	{
		cout<<m/2;
	}else{
		for(int i=3;i<=n;i++)
		{
			if(m%i==0)
			{
				cout<<m/i;
				break;
			}
		}
	}
	
	return 0;
}

J

注意到七巧板切六个为最优的情况,最上面那一块不在我们的考虑范围内。

推理了多次发现最优情况是第一次切从6开始,接下来每一次在上一次的基础上加1,也就是6,7,8,9这样累加即可。

#include<iostream>
using namespace std;
#define ll long long
ll n,tot;

int main()
{
	while(cin>>n)
	{
		//tot=7;
		
		cout<<7+(11+n)*n/2<<endl;
	}
	
	
	
	return 0;
}

H

用AI给了点思路发现我们两个边界判断出问题了,这个才是正确的

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

const int L = 259200; // 12小时;每秒对应6个角度单位

int cw(int x, int y) {
    return (y - x + L) % L;
}
int ccw(int x, int y) {
    return (x - y + L) % L;
}
int readAngle() {
    int h, m, s;
    cin >> h >> m >> s;
    return ((h % 12) * 3600 + m * 60 + s) * 6;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    while (cin >> n) {
        int p = readAngle();
        vector<int> a(n);
        for (int &x : a) x = readAngle();

        sort(a.begin(), a.end());
        a.erase(unique(a.begin(), a.end()), a.end());

        int ansCW = 0, ansCCW = 0;
        for (int x : a) {
            ansCW = max(ansCW, cw(p, x));
            ansCCW = max(ansCCW, ccw(p, x));
        }
        int ans = min(ansCW, ansCCW);

        for (int i = 0; i < (int)a.size(); ++i) {
            int x = a[i];
            int y = a[(i + 1) % a.size()];
            int gap = cw(x, y);
            if (gap == 0) continue; // 只有一个不同目标时,上面的单方向答案已足够
            int rest = L - gap;
            ans = min(ans, cw(p, x) + rest);
            ans = min(ans, ccw(p, y) + rest);
        }

        cout << fixed << setprecision(2) << (double)ans << '\n';
    }
}
posted @ 2026-10-03 22:49  Miya555  阅读(9)  评论(0)    收藏  举报