【玲珑杯Round17】xjb总结
zcy真是垃圾,啥都不会的那种。
菜的不行。
这场手速上了三题,然后各种E被卡……
日个吗居然E不开栈,傻逼吧
有毒吧
来看题:
A.sqc给的我的神奇公式,gtmd居然能A?
- #include<bits/stdc++.h>
- using namespace std;
- int n;double ans=;
- int main(){
- scanf("%d",&n);
- for(int i=;i<n-;i++){
- int j=(n-i)/,k=(n-i)-(n-i)/;
- ans=max(ans,sin(i)+sin(j)+sin(k));
- }
- printf("%.9lf\n",ans);
- }
B.小学生容斥,2^m次系列。
- #include <stdio.h>
- #include <iostream>
- #include <algorithm>
- #include <memory.h>
- using namespace std;
- typedef long long ll;
- #define N 2
- const int maxn=;
- const int L=<<;
- int a[maxn],T,n,m;ll f[L];int bin[L];
- ll gcd(ll n,ll m){
- return m?gcd(m,n%m):n;
- }
- inline ll lcm(ll n,ll m){return n/gcd(n,m)*m;}
- void dfs(int stp,int s,ll w){
- if (w>n) return ;
- if (stp>m) {f[s]+=n/w;return ;}
- dfs(stp+,s<<,w);
- dfs(stp+,s<<|,lcm(w,a[stp]));
- }
- int main(){
- for (int i=;i<L;i++) bin[i]=bin[i>>]+(i&);
- for (scanf("%d",&T);T--;) {
- memset(f,,sizeof f);
- scanf("%d %d",&n,&m);
- for (int i=;i<=m;i++) scanf("%d",&a[i]);
- dfs(,,);ll ans=;
- for (int j=;j<m;j++)
- for (int i=;i<(<<m);i++)
- if (((i>>j)&)==) f[i]-=f[i+(<<j)];
- for (int i=;i<(<<m);i++)
- if (bin[i]&) ans+=f[i];
- printf("%lld\n",ans);
- }
- return ;
- }
剩下就一堆不会……
Ctm烦得跟什么一样,Etm卡空间卡常数,还狗日的不开栈。
D裸FFT算下。
- #include<bits/stdc++.h>
- #define N 1000005
- typedef long long ll;
- using namespace std;
- const double pi=acos(-);
- struct E{
- double x,y;
- E (double x=,double y=):x(x),y(y){}
- }a[N];
- E operator+(const E &a,const E &b){return E(a.x+b.x,a.y+b.y);}
- E operator-(const E &a,const E &b){return E(a.x-b.x,a.y-b.y);}
- E operator*(const E &a,const E &b){return E(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);}
- int n,m,l,q,L,nmax;
- int r[N],c[N];ll ans[N];
- void FFT(E *x,int k){
- for (int i=;i<n;i++) if (i<r[i]) swap(x[i],x[r[i]]);
- for (int i=;i<n;i<<=){
- E wn(cos(pi/i),sin(pi*k/i));
- for (int j=;j<n;j+=(i<<)){
- E w(,),l,r;
- for (int p=j;p<j+i;p++,w=w*wn){
- l=x[p],r=x[p+i];
- x[p]=l+w*r;
- x[p+i]=l-w*r;
- }
- }
- }
- if (k==-) for (int i=;i<=n;i++) x[i].x/=n;
- }
- inline int read(){
- int f=,x=;char ch;
- do{ch=getchar();if(ch=='-')f=-;}while(ch<''||ch>'');
- do{x=x*+ch-'';ch=getchar();}while(ch>=''&&ch<='');
- return f*x;
- }
- int main(){
- int T=read();
- while(T--){
- n=read();q=read();m=n;nmax=;L=;
- memset(ans,,sizeof(ans));memset(a,,sizeof(a));
- for(int i=;i<=m;i++)c[i]=read(),nmax=max(n,c[i]),a[c[i]].x++;
- nmax*=;for (n=;n<=nmax;n<<=,L++);
- for(int i=;i<n;i++)r[i]=(r[i>>]>>)|((i&)<<(L-));
- FFT(a,);
- for(int i=;i<=n;i++)a[i]=a[i]*a[i];
- FFT(a,-);
- for(int i=;i<=n;i++)ans[i]=(ll)(a[i].x+0.5);
- for(int i=;i<=m;i++)ans[c[i]*]--;
- for(int i=;i<=n;i++)ans[i]>>=;
- for(int i=n;i>=;i--)ans[i]+=ans[i+];
- for(int i=;i<=q;i++){
- int k=read();printf("%lld\n",ans[k]);
- }
- }
- }
好气啊,要是知道开栈我就能rank1了
巨气。
【玲珑杯Round17】xjb总结的更多相关文章
- 程设大作业xjb写——魔方复原
鸽了那么久总算期中过[爆]去[炸]了...该是时候写写大作业了 [总不能丢给他们不会写的来做吧 一.三阶魔方的几个基本定义 ↑就像这样,可以定义面的称呼:上U下D左L右R前F后B UD之间的叫E,LR ...
- hdu_5881_Tea(xjb猜)
题目链接:hdu_5881_Tea 题意: 有一壶水, 体积在 L 和 R 之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不 ...
- hdu_5873_Football Games(xjb搞)
题目链接:hdu_5873_Football Games 题意: 有n个队,每个队都会给其他队打一场,赢一场得2分,平局得一分,输了不得分,然后给你全部比赛结束后的得分,问你是否有假分 题解: 可以知 ...
- hdu_5761_Rower Bo(xjb猜公式)
题目链接:hdu_5761_Rower Bo 题意: 让你求一个物理问题 题解: xjb猜公式,由题目样例可得,答案为8/7,然后我们可以xjb猜出公式为v1*a/(v1*v1-v2*v2),然后特判 ...
- “玲珑杯”ACM比赛 Round #12题解&源码
我能说我比较傻么!就只能做一道签到题,没办法,我就先写下A题的题解&源码吧,日后补上剩余题的题解&源码吧! A ...
- “玲珑杯”ACM比赛 Round #19题解&源码【A,规律,B,二分,C,牛顿迭代法,D,平衡树,E,概率dp】
A -- simple math problem Time Limit:2s Memory Limit:128MByte Submissions:1599Solved:270 SAMPLE INPUT ...
- “玲珑杯”ACM比赛 Round #19 B -- Buildings (RMQ + 二分)
“玲珑杯”ACM比赛 Round #19 Start Time:2017-07-29 14:00:00 End Time:2017-07-29 16:30:00 Refresh Time:2017-0 ...
- “玲珑杯”ACM比赛 Round #1
Start Time:2016-08-20 13:00:00 End Time:2016-08-20 18:00:00 Refresh Time:2017-11-12 19:51:52 Public ...
- 玲珑杯”ACM比赛 Round #15
手速狗从西安回来一只浑浑噩噩,好不容易迎来一场送饭比赛体验一把河南的优势,结果被高中生狂虐,无缘奖金..我的奖品梦就这样一次次被打破.... A -- Reverse the lights 最后半小时 ...
随机推荐
- 【bzoj2653】middle 可持久化线段树区间合并
题目描述 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整.给你一个长度为n的序列s.回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[ ...
- Hyperledger Fabric 实战(十): Fabric node SDK 样例 - 投票DAPP
Fabric node SDK 样例 - 投票DAPP 参考 fabric-samples 下的 fabcar 加以实现 目录结构 . ├── app │ ├── controllers │ │ └─ ...
- BZOJ5288 & 洛谷4436 & LOJ2508:[HNOI/AHOI2018]游戏——题解
https://www.lydsy.com/JudgeOnline/problem.php?id=5288 https://www.luogu.org/problemnew/show/P4436 ht ...
- BZOJ2820:YY的GCD——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=2820 Description 神犇YY虐完数论后给傻×kAc出了一题给定N, M,求1<=x& ...
- 数组分组chunk的一种写法
lodash的_.chunk函数可以将数组按照数量分成若干组, 例如: const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; const groupByN ...
- 【并查集】【P1525】关押罪犯
传送门 Description Input Output Sample Input Sample Output Hint Solution 非常显然的并查集题目,在本题中,对于每个罪犯i,维护两个信息 ...
- Android LocalBroadcastManager解析
阿里巴巴Android开发手册[强制]避免使用隐式 Intent 广播敏感信息,信息可能被其他注册了对应BroadcastReceiver 的 App 接收.说明:通过 Context#sendBro ...
- mysql 常用总结
centos7 安装mysql 数据库安装参考:http://www.cnblogs.com/longrui/p/6071581.htmlhttps://www.cnblogs.com/yoursou ...
- 初学VS的目录结构
工程目录下各文件的含义 一般大部分的文章可能介绍到上面就算结束了,但我这还没有.创建工程产生的各个文件都你知道是什么用的吗? 如果你是一个初学者,你可能会不知道(老手请跳过本文).Ok,我就带你逐一了 ...
- HDU1542 扫描线+离散化
Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...