Tag: Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (C) Jury Marks Solution In C/C++

#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>k>>n; int t; int arr; set<int>c; for(int i=0;i<k;i++){ cin>>t; arr= arr+t; } for(int i=0;i<n;i++){ cin>>t; set<int>mmp; for(int j=0;j<k;j++){ int x = t-arr; if(!i||(c.find(x) != c.end())){ mmp.insert(x); } } c =mmp; } cout<<c.size(); return...

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (G) Can Bash Save the Day? Solution in C/C++

#include<bits/stdc++.h> #define N 200100 using namespace std; int sz; vector<int> g,w; int loc,dep,tloc,td; long long len; bool del; void build(int u, int p, int ly,...

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (F) Team Rocket Rises Again Solution in C/C++

#include <bits/stdc++.h> #define F first #define S second #define X real() #define Y imag() using namespace std; typedef long long ll; typedef long double...

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (E) Bash Plays with Functions Solution in C/C++

#include <cstdio> const int mod = 1000000007; int a; int b; int main() { int q, r, n; a = 1; for (int j...

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (D) Felicity’s Big Secret Revealed Solution in C/C++

#include<stdio.h> #define m 1000000007u typedef unsigned u; u D,S; char C; u V; int main() { u n,i,j,k,N=1u<<20,b,r=0; scanf("%u",&n); scanf("%s",C); for(i=-1;++i<n;)for(j=i-1,k=0;++j<n;) { k=k<<1|(C=='1'); V=k; } for(i=-1;++i<=n;)D=1; for(i=-1;++i<n;) { for(j=i-1;++j<n;) { if(!V)continue; if(V>20)break; b=1u<<(V-1); for(k=-1;++k<N;) if((D+=D)>=m)D-=m; } } for(i=-1;++i<=n;) { for(j=1;j<N;j=j<<1|1) if((r+=D)>=m)r-=m; } printf("%un",r); return 0; }

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (C) Felicity is Coming! Solution in C/C++

#include<stdio.h> #include<stdlib.h> #define m 1000000007u typedef long long unsigned llu; typedef unsigned u; int C(const void*x,const void*y){return*(u*)x-*(u*)y;} int D(const void*x,const void*y) { if(*(llu*)x>*(llu*)y)return 1; if(*(llu*)x<*(llu*)y)return-1; return 0; } llu...

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (B) Bash’s Big Day Solution in C/C++

#include <stdio.h> int main(){ int n; scanf("%d",&n); int i, temp, max=1, freq={0}, ans=1, j; for(i=0;i<n;i++){ scanf("%d",&temp); freq++; if(temp>max){ max=temp; } } for(i=2; i<=max; ++i){ temp=0; for(j=i; j<=max; j+=i){ temp+=freq; } if(temp>ans) ans=temp; } printf("%d",ans); return 0; }

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!