https://vjudge.net/contest/247919#problem/I
A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n, sum;
cin >> n;
sum = 0;
sum = n * (1 + n) / 2 - n + 1;
cout<<sum<<endl;
return 0;
}
B.
#include <bits/stdc++.h>
using namespace std;
int mi(int a, int b)
{
return a * a + b * b;
}
int main()
{
int a, b, c, d, x, y;
cin >> a >> b >> c >> d;
x = mi(a,b);
y = mi(c,d);
if(x > y) printf("Wil\n");
else if( x < y) printf("Russo\n");
else printf("Empate\n");
return 0;
}
C.
#include <bits/stdc++.h>
using namespace std;
struct node
{
int x, y, z;
}t[5001];
int main()
{
int n, x, y, z, i, j;
char s[5];
scanf("%d",&n);
i = 0;
while(n--)
{
scanf("%s",s);
scanf("%d %d %d", &x, &y, &z);
if(s[0] == 'A')
{
if(!i)
{
t[i].x = x;
t[i].y = y;
t[i++].z = z;
printf("Ok\n");
}
else
{
for(j = 0; j < i; j++)
{
if((t[j].x - x) * (t[j].x - x) +(t[j].y - y) * (t[j].y - y) < (t[j].z + z) * (t[j].z +z) )
{
printf("No\n");
break;
}
}
if(j >= i)
{
t[i].x = x;
t[i].y = y;
t[i++].z = z;
printf("Ok\n");
}
}
}
else
{
int f = 1;
for(j = 0; j < i; j++)
{
if(t[j].x == x && t[j].y == y && t[j].z == z)
{
int l = j;
for(; l < i - 1; l++)
{
t[l] = t[l+1];
}
i--;
f = 0;
printf("Ok\n");
break;
}
}
if(f) printf("No\n");
}
}
return 0;
}
D.
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n, s, sum, a[100010];
cin>>n;
s = 0;
for(int i = 0; i < n; i++)
{
cin>>a[i];
s += a[i];
}
sum = 0;
for(int
i = 0; i < n; i++)
{
s -= a[i];
sum += a[i] * s;
}
cout<<sum<<endl;
return 0;
}
F.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, s, x;
cin>>n;
s = 0;
for(int i; i < n; i++)
{
cin >> x;
s += x;
}
int y = s/5;
if(s % 5)
y++;
cout << y << endl;
return 0;
}
G.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, i, k, m;
long long a[5] = {0};
scanf("%d",&n);
for(i=1; i <= n; i++)
{
k = i;
while(k > 4)
{
k -= 4;
}
scanf("%d",&m);
a[k] += m;
}
int max = a[1];
int j = 1;
for(i = 2; i <= 4; i++)
{
if(max < a[i])
{
max = a[i];
j = i;
}
}
for(i = 1; i <= 4; i++)
{
if(max == a[i] && i != j)
{
if(i < j)
{
j = i;
}
}
}
printf("%c\n",64 +j);
return 0;
}
L.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a, s, x;
cin>>n;
x = 10000;
s = 0;
for(int i = 0; i < n; i++)
{
cin>>a;
s += a;
if(a % 2)
{
if(a < x)
x = a;
}
}
if(s % 2)
s -= x;
cout<<s<<endl;
return 0;
}
I.
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long t, a, b;
cin>>t;
while(t--)
{
cin>>a>>b;
if((a - b >= 0 && a - b <= 1)||(b - a >= 0 && b - a <= 1))
cout << "OK" << endl;
else
{
if( (a + b) & 2)
{
cout << (a + b) / 2 << " " << (a + b) / 2 + 1 <<endl;
}
else
cout << (a + b) / 2 << " " << (a + b) / 2 << endl;
}
}
return 0;
}