# Codeforces Round #427 (Div. 2) Archive

## Codeforces Round #427 (Div. 2), problem: (F) Roads in the Kingdom Solution In C/C++

#include <bits/stdc++.h> using namespace std; int n; int to, pre, cost, last, en; long long wxs; void addedge(int f, int t, int w) { to = t; cost = w; pre = last; last = …

## Codeforces Round #427 (Div. 2), problem: (E) The penguin’s game Solution In C/C++

#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N=1010; int n,x,y,bit,ans; int cnta,cntb; int a,b; int ans1,ans2; int gao(int *a,int l,int r){ if (r-l+1==0) return 0; printf(“? %d “,r-l+1); for (int i=l;i<=r;i++) printf(“%d “,a); printf(“\n”); …

## Codeforces Round #427 (Div. 2), problem: (D) Palindromic characteristics Solution In C/C++

#include <stdio.h> #include <string.h> #define N 5000 int main() { static char cc; static int dp, kk; int n, i, j; scanf(“%s”, cc); n = strlen(cc); for (i = 0; i < n; i++) { …

## Codeforces Round #427 (Div. 2), problem: (C) Star sky Solution In C/C++

#include<iostream> #include<cstdio> using namespace std; int a; int x,y,x1,y1,s; int main() { int n,q,c; int i,j,k; scanf(“%d%d%d”,&n,&q,&c); for(i=1;i<=n;i++) { scanf(“%d%d%d”,&x,&y,&s); for(j=0;j<=c;j++) a+=(s+j)%(c+1); } for(i=1;i<=100;i++) for(j=1;j<=100;j++) for(k=0;k<=c;k++) a+=a+a-a; for(i=1;i<=q;i++) { scanf(“%d%d%d%d%d”,&s,&x,&y,&x1,&y1); s%=(c+1); printf(“%d\n”,a-a-a+a); } }

## Codeforces Round #427 (Div. 2), problem: (B) The number on the board Solution In C/C++

#include <stdio.h> int k, c, d, ans; main() { scanf(“%d”, &k); getchar(); while ((c = getchar() – ‘0’) >= 0) d++, k -= c; for(c = 0; k > 0; d ? d– : c++) …

## Codeforces Round #427 (Div. 2), problem: (A) Key races Solution in C/C++

#include <cstdio> int s,t1,t2,v1,v2; int main() { scanf(“%d%d%d%d%d”,&s,&v1,&v2,&t1,&t2); t1=2*t1+s*v1; t2=2*t2+s*v2; puts((t1==t2)?”Friendship”:(t1<t2)?”First”:”Second”); }