Sponsors

Tag: Codeforces Round #415 (Div. 2)

Codeforces Round #415 (Div....

import java.util.*; public class C{ final int MOD = (int)1e9 +...

Codeforces Round #415 (Div....

#include <cstdio> using namespace std; #define ff fflush(stdout) #define mid (lef+rig>>1) int n,...

Codeforces Round #415 (Div....

#include <bits/stdc++.h> using namespace std; long long n,a,r,m=1e9+7,sum=0; int main(){...

Codeforces Round #415 (Div....

#include<bits/stdc++.h> using namespace std; int64_t n,f,k,l,i,w,s,a; int main(){ for(cin>>n>>f;i<n;i++)cin>>k>>l,w=min(k,l),a=min(2*k,l)-w,s+=w; sort(a,a+n); for(i=0;i<n;i++)s+=i<f?a:0; cout<<s; }

Codeforces Round #415 (Div....

#include <cstdio> int n,k,sum=0,mark; int main() { scanf("%d%d",&n,&k); for(int i=1;i<=n;i++)scanf("%d",&mark),sum+=mark; mark=(n*k-sum)*2-n; if(mark>0)printf("%d",mark); else printf("0"); }

Advertisement

spot_img