最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

CodeforcesRound#262(Div.2)-A,B,C,D_html/css

来源:懂视网 责编:小采 时间:2020-11-27 15:54:56
文档

CodeforcesRound#262(Div.2)-A,B,C,D_html/css

CodeforcesRound#262(Div.2)-A,B,C,D_html/css_WEB-ITnose:A. Vasya and Socks 水题就不用多说了,直接暴力枚举就完事了。 #include #include#include#include#include#include#includeusing namespace std;#define LL __int64int main(){ int n,k; while(~scanf(
推荐度:
导读CodeforcesRound#262(Div.2)-A,B,C,D_html/css_WEB-ITnose:A. Vasya and Socks 水题就不用多说了,直接暴力枚举就完事了。 #include #include#include#include#include#include#includeusing namespace std;#define LL __int64int main(){ int n,k; while(~scanf(

A. Vasya and Socks

水题就不用多说了,直接暴力枚举就完事了。

#include #include#include#include#include#include#includeusing namespace std;#define LL __int64int main(){ int n,k; while(~scanf("%d%d",&n,&k)) { int m=n; int ans=n; int yu=0; while(m) { m=m+yu; yu=m%k; m=m/k; ans+=m; } cout< 
B. Little Dima and Equation

也不用说,水题一个,直接枚举s(x),然后得到x,然后根据x推出s(x)是不是合适。

当时把81写成了72,不由的十分悲伤,sad.

#include #include#include#include#include#include#includeusing namespace std;#define LL __int64#define INF 1000000000vectorvec;LL pows(LL x,LL y){ LL ans=1; while(y--)ans=ans*x; return ans;}int dus(LL x){ int ans=0; while(x) { ans=ans+x%10; x=x/10; } return ans;}int main(){ int n,k; int a,b,c; while(~scanf("%d%d%d",&a,&b,&c)) { LL ans=0; vec.clear(); for(int i=1;i<=81;i++) { ans=(LL)b; ans=ans*pows(i,a); ans=ans+(LL)c; if(ans>=INF)break; if(ans<=0)continue; if(dus(ans)==i)vec.push_back(ans); } cout<

C. Present

二分+贪心。也是一种水题的表现形式。。

二分一下结果,贪心看当前结果能不能达到。

#include #include#include#include#include#include#includeusing namespace std;#define LL __int64#define INF 1000000000#define maxn 220000LL a[maxn];LL b[maxn];LL flag[maxn];LL n,w;LL qiu(LL x){ memset(flag,0,sizeof(flag)); for(LL i=1;i<=n;i++) { b[i]=x-a[i]; } LL ch=0; LL ans=0; for(LL i=1;i<=n;i++) { ch-=flag[i]; b[i]-=ch; if(b[i]<0)b[i]=0; flag[i+w]+=b[i]; ch+=b[i]; ans+=b[i]; } return ans;}int main(){ LL m; while(~scanf("%I64d%I64d%I64d",&n,&m,&w)) { for(LL i=1;i<=n;i++)scanf("%I64d",&a[i]); LL l=0; LL r=1e9; r=r*2; LL mid=(l+r)/2; while(lm)r=mid; else l=mid+1; mid=(l+r)/2; } mid--; cout<

D. Little Victor and Set

写这个题的时候要多悲剧有多悲剧,竟然在我认为最不可能错的地方写错了。

我很悲伤.

n=r-l+1;

若n<=20,很明显状态压缩就OK。

若k<=3.

当k=1时,很明显取l。

当k=2时,很明显取两个相邻的,并且只有末位不同的数,他们的异或结果为1.

当k=3时,第一个数取l,然后假如结果为0,算出剩下两个数的最小值。如果两个数最大的

不大于r,那我们就取这三个数,否则取两个数使得结果为1.

当k>=4时:

对于下面两个数交替处:

..........0111110 k-2

..........0111111 k-1

..........1000000 k

..........1000001 k+1

很明显我们可以看出来k-2,k-1,k,k+1的异或值为0。

因为n>20,我们一定能找出这种k。

#include #include#include#include#include#include#includeusing namespace std;#define LL __int64#define INF 1000000000#define maxn 220000void dos1(LL l,LL r,LL k){ LL n=r-l+1; LL st=((LL)1)<k)continue; if(res>ans) { res=ans; rst=i; } } len=0; for(LL i=0; i=0; i--) { if((l&(((LL)1)<>i); n=(n<=l&&k+1<=r) { return k; } else if(k-2r)return dos2(l,k-1,ks); } } return 0;}void dos3(LL l,LL r,LL k){ if(k==1) { cout<=0; i--) { if(l&(((LL)1)<

文档

CodeforcesRound#262(Div.2)-A,B,C,D_html/css

CodeforcesRound#262(Div.2)-A,B,C,D_html/css_WEB-ITnose:A. Vasya and Socks 水题就不用多说了,直接暴力枚举就完事了。 #include #include#include#include#include#include#includeusing namespace std;#define LL __int64int main(){ int n,k; while(~scanf(
推荐度:
标签: it a c
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top