AtCoder Beginner Contest 057(ABCD)
AtCoder Beginner Contest 057(ABCD)
A - Remaining Time
直接模拟取模。
B - Checkpoints
暴力枚举。
C - Digits in Multiplication
一开始想复杂以为是质因数分解,因为只要求找出所有的 p a i r ( A , B ) , A B = N pair(A,B),AB=N pair(A,B),AB=N
显然可以暴力枚举 A A A。
D - Maximum Average Sets
贪心,显然取 a a a个最大的是最优的,因为越取多,数可能会变小,平均值也可能变小,接下只需特判这 a a a个数中最小的那个数 x x x的个数,如果小于 a a a,则 c n t = C ( t o t x , c n t x ) cnt=C(tot_x,cnt_x) cnt=C(totx?,cntx?)
【AtCoder Beginner Contest 057(ABCD)】如果 c n t x = = a cnt_x==a cntx?==a,说明可以继续取 ∑ i = a m i n ( b , t o t x ) C ( t o t x , i ) \sum_{i=a}^{min(b,tot_x)} C(tot_x,i) ∑i=amin(b,totx?)?C(totx?,i)
#include
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair
#define fi first
#define se second
#define pb push_back
#define il inline
mapmp,g;
ll f[N];
ll C[N][N];
void solve(int n){
for(int i=1;
i<=n;
i++) C[i][0]=C[i][i]=1;
for(int i=2;
i<=n;
i++)
for(int j=1;
j>n>>a>>b;
map::reverse_iterator it;
for(int i=1;
i<=n;
i++){
cin>>f[i],mp[f[i]]++;
}
sort(f+1,f+n+1,greater());
ll cnt=0,x=0;
for(int i=1;
i<=a;
i++){
x+=f[i];
if(f[i]==f[a]) cnt++;
}
printf("%.6f\n",(double)x/a);
ll c=0;
x=f[a];
if(cnt=i;
i++){
c+=C[mp[x]][i];
}
}
cout<
推荐阅读
- 上岸算法LeetCode|上岸算法LeetCode Weekly Contest 276解题报告
- hdu|2016 Multi-University Training Contest 1 C Game(hdu 5725)
- 数论|AtCoder Beginner Contest 156 C.Rally
- 2018-2019|2018-2019, ICPC, Asia Yokohama Regional Contest 2018 K
- 2018-2019|2018-2019, ICPC, Asia Yokohama Regional Contest 2018 C、Emergency Evacuation(逆向思维)
- 初生菜鸟|2019The 44th International Collegiate Programming Contest Asia Shenyang Regional Contest
- 2019 GDUT Rating Contest #II 这是群题解,七篇!!!
- # 2019 GDUT Rating Contest #I H. Mixing Milk
- # 2019 GDUT Rating Contest #I A. The Bucket List
- # 2019 GDUT Rating Contest #I G. Back and Forth