# C Archive

## Codeforces Round #444 (Div. 2), problem: (B) Cubes for Masha Solution In C/C++

#include<stdio.h> int main() { int n,i,j,k,m,A,B; scanf(“%d”,&n); for(i=1;i<=n;i++){ for(j=1;j<=6;j++){ scanf(“%d”,&A);} } for(i=1;i<=100;i++){ B=0;} for(i=1;i<=n;i++){ for(j=1;j<=6;j++){ B]=1; for(k=1;k<=n;k++){ for(m=1;m<=6;m++){ if (k!=i){ B*10+A]=1; } } } } } i=1; while(B){ i++;} printf(“%d”,i-1); return 0; }

## Codeforces Round #444 (Div. 2), problem: (A) Div. 64 Solution In C/C++

#include<stdio.h> char s; int main() { scanf(” %s”,s); int x=0,y=0,z=0; while(s==’0′) x++; while(s!=0) z++; for(int i=x+1;i<z;i++) if(s==’0′) y++; if(y>=6) printf(“yes”); else printf(“no”); return 0; }

## Codeforces Round #436 (Div. 2), problem: (F) Cities Excursions Solution In C/C++

#include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int N = 3005, INF = 0x3f3f3f3f; int n, m, q, f; bool vis; struct Edge { int to; Edge *next; Edge () {} Edge (int to, Edge …

## Codeforces Round #436 (Div. 2), problem: (E) Fire Solution In C/C++

#include<iostream> #include<cstdio> #include<algorithm> #include<bitset> using namespace std; struct node{ int t,d,p,tot; }a; int f; bool cmp(node x,node y){ return x.d<y.d; } bitset<150> ans; int cc; int main(){ int n; scanf(“%d”,&n); for (int i=1;i<=n;++i){ scanf(“%d%d%d”,&a.t,&a.d,&a.p); a.tot=i; …

## Codeforces Round #436 (Div. 2), problem: (D) Make a Permutation! Solution In C/C++

#include<stdio.h> int a, b, sum, flag; int main(void) { int n, i, p, k; scanf(“%d”, &n); for(i=1;i<=n;i++) { scanf(“%d”, &a); sum]++; } k = 0; for(i=1;i<=n;i++) { if(sum==0) b = i; } printf(“%d\n”, k); p …

## Codeforces Round #436 (Div. 2), problem: (C) Bus Solution In C/C++

#include <bits/stdc++.h> using namespace std; int main(){ int k,sum=0,end,cap,f,tank; for(cin>>end>>cap>>f>>k,tank=cap;k–;f=end-f) if(tank<f||cap<end-f) return cout<<-1,0; else if(tank>=end+(k?end-f:0)) tank-=end; else ++sum,tank=cap-(end-f); cout<<sum; }

## Codeforces Round #436 (Div. 2), problem: (B) Polycarp and Letters Solution In C/C++

#include <stdio.h> int c; void reset(){ for(int i=0;i<26;i++){ c=0; } } int main(){ int n,i,cur=0,max=0; scanf(“%d”,&n); char a; scanf(“%s”,a); reset(); for(i=0;i<n;i++){ if(a>=’A’ && a<=’Z’){ cur=0; reset(); } else if(c-‘a’]==0){ c-‘a’]++; cur++; } if(cur>max){ max=cur; } …

## Codeforces Round #436 (Div. 2), problem: (A) Fair Game Solution In C/C++

#include<cstdio> #include<iostream> using namespace std; int n,cnt,ans,A,B; int buck; int main(){ scanf(“%d”,&n); for(int i = 1;i <= n;i++){ cin >> cnt; if(!buck){ ans++; if(A) B = cnt; else A = cnt; } buck++; } if(ans …

## Codeforces Round #429 (Div. 1), problem: (D) Destiny Solution In C/C++

#include <bits/stdc++.h> using namespace std; const int maxN = 3e5+10, base = 1e9+7; int N, Q, ans, valmid, A; bool cmp(int x) { return x <= valmid; } struct wavelet_tree { int low, high; wavelet_tree …

## Codeforces Round #429 (Div. 2), problem: (E) On the Bench Solution In C/C++

#include<bits/stdc++.h> #define ll long long int #define LL long long int #define ULL unsigned long long int #define sf(a) scanf(“%d”,&a) #define sl(a) scanf(“%lld”,&a) #define fr first #define sc second #define pii pair<int,int> #define pll pair<LL,LL> …