第 45 届国际大学生程序设计竞赛(ICPC)亚洲区域赛(沈阳)(重现赛)
传送门:ICPC沈阳
F - The Witchwood
这重现赛,这数据,我既然被hack了,我写的代码太拉跨了?????
对原来的代码做了亿点点修改:对于每一个小区间,区间内的和与排序后区间内的和是一样的。所以。。。。
#pragma warning(disable:4996)
#include<iostream>
#include<string.h>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<set>
#include<algorithm>
#include<sstream>
#include<vector>
#include<ctype.h>
#include<list>
//#include <unordered_map>
#include<deque>
#include<functional>
using namespace std;
const int maxn = 1e6 + 9;
long long a[maxn], sorted[maxn], le = 0, ri = 0, minn = 0x3f3f3f3f, maxx = 0;
int main()
{
int n, ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
sorted[i] = a[i];
}
long long suma = 0, sumb = 0;
sort(sorted, sorted + n);
for (int i = 0; i < n; i++) {
suma += a[i];
sumb += sorted[i];
if (suma == sumb)ans++;
}
cout << ans;
return 0;
}
G - The Witchwood
solved by Micky. 00:32:02(+)
签到。略
#pragma warning(disable:4996)
#include<iostream>
#include<string.h>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<set>
#include<algorithm>
#include<sstream>
#include<vector>
#include<ctype.h>
#include<list>
//#include <unordered_map>
#include<deque>
#include<functional>
using namespace std;
const int maxn = 1e5 + 9;
long long a[maxn], ans, n, k;
int main()
{
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = n - 1; i >= n - k; i--) {
ans += a[i];
}
cout << ans;
return 0;
}
I - Rise of Shadows
solved by oye (after).
题意:
给你一个特定的钟,有H小时,每小时有M分钟。问从0:00开始,时钟转完一圈的时间内,分钟和时钟的夹角小于等于 2 π A H M \frac{2\pi A}{HM} HM2πA的次数有几次(分针指到格子线才算一次)
一开始,我和我的队友都以为是追及问题,怎么都过不了,一直卡到赛后。也不明白为什么是奇数,后来才发现,最后的那个重合是不用算的,相当于我们现实生活中,实际有效时间其实只有0:00~11:59(我指转一圈)。
因为要分针指到格子线才算一次,追及算时间算路程那个没法用,所以用假设先把题目化成通式。
假设一时间为 t ( t ∈ [ 0 , H M ) , t ∈ Z , 单 位 : 分 钟 ) t(t\in[0,HM),t\in Z,单位:分钟) t(t∈[0,HM),t∈Z,</