var
x,y,t:integer;
begin
write('x=');
readln(x);
write('y=');
readln(y);
t:=x;
x:=y;
y:=t;
writeln('x=',x,' y=',y);
readln;
end.
#include <iostream>
#include <vector>
#include <set>
#define ll long long
using namespace std;
signed main() {
ll n;
cin >> n;
vector<pair<ll,ll>> a(n);
vector<ll> pref(n,0),d(n,0),ans(n,0);
set<ll> s;
for(ll i = 0; i < n; i++){
cin >> a[i].first;
a[i].second = i;
s.insert(a[i].first);
if(i == 0)
pref[i] = a[i].first;
else
pref[i] = pref[i-1] + a[i].first;
d[i] = s.size();
}
if(d[n-1] > 1 || n == 1)
ans[a[n-1].second] = 1;
for(ll i = n - 2; i >= 0; i--){
if(pref[i] > a[i + 1].first && ans[a[i+1].second] == 1 && d[i] > 1)
ans[a[i].second] = 1;
}
for(ll i = 0; i < n; i++)
cout << ans[i] << " ";
}
P.S. Откуда задача, уж больно часто я ее встречаю на подобных сайтах
#include <iostream>
#include <vector>
using namespace std;
int am_dig(int k){
int res = 0;
while(k > 0){
res++;
k /= 10;
}
return res;
}
double average(vector<double> a){
double sum = 0;
for(auto i: a)
sum += i;
return sum/a.size();
}
int main() {
vector<double> a;
double x = 1;
while(x != 0){
cin >> x;
if(am_dig(x) == 3)
a.push_back(x);
}
if(a.size() == 0)
cout << "NO";
else
cout << average(a);
}
Program Pr1;
uses crt;
var x,y,t:integer;
Begin
clrscr;
readln(x,y);
t:=x;
x:=y;
y:=t;
writeln(x,y);
end.