http://codeforces.com/contest/604
A:
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <ctype.h>
#include <time.h>
#include <queue>
#include <map>
#include <set>
using namespace std;
int m[6];
int w[6];
int hs,hu;
int a[10] = {0,500, 1000, 1500, 2000, 2500};
int main()
{
cin>>m[1]>>m[2]>>m[3]>>m[4]>>m[5];
cin>>w[1]>>w[2]>>w[3]>>w[4]>>w[5];
cin>>hs>>hu;
int ans =0;
for(int i=1;i<=5;i++)
ans += max(a[i]/10*3,a[i] - a[i]/250*m[i] - 50*w[i]);
ans += 100*hs;
ans += -50*hu;
cout<<ans<<endl;
return 0;
}
B:
#include <iostream>
#include <set>
#include <string>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
int n, k;
long long a[100010];
int main()
{
while (cin >> n >> k)
{
for (int i = 1;i <= n;i++)
cin >> a[i];
long long ans = a[n];
int num = n - k;
for (int i = 1;i <= num;i++)
{
ans = max(ans, a[i] + a[2 * num - i + 1]);
}
cout << ans << endl;
}
return 0;
}
C:
#include <iostream>
#include <set>
#include <string>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
int n;
char s[100010];
int main()
{
while (cin >> n)
{
cin >> s;
int pos = 0;
int len = strlen(s);
int cnt1 = 0, cnt2 = 0;
while (pos < len)
{
if (s[pos] == s[pos + 1])
{
cnt2++;
}
else
{
cnt1++;
}
pos++;
}
//cout << cnt1 << " " << cnt2 << endl;
int ans = cnt1 + min(2, cnt2);
cout << ans << endl;
}
return 0;
}