44
Объяснение:
s = - 1
нц для x от 10 до -3 шаг -2
Действия в цикле:
1) s = s - x
2) s = s + 1
Вывод s * x
x = 10 s = -1
1) s = s - x = -1 - 10 = -11
2) s = s + 1 = -11 + 1 = -10
x = 8 s = -10
1) s = s - x = -10 - 8 = -18
2) s = s + 1 = -18 + 1 = -17
x = 6 s = -17
1) s = s - x = -17 - 6 = -23
2) s = s + 1 = -23 + 1 = -22
x = 4 s = -22
1) s = s - x = -22 - 4 = -26
2) s = s + 1 = -26 + 1 = -25
x = 2 s = -25
1) s = s - x = -25 - 2 = -27
2) s = s + 1 = -27 + 1 = -26
x = 0 s = -26
1) s = s - x = -26 - 0 = -26
x = -2 s = -25
1) s = s - x = -25 - (-2) = -25 + 2 = -23
Цикл закончился
x = -2 s = -22
s * x = -2 * -22 = 44
Вывод 44
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
signed main(){
const ll n = 20;
ll a[n];
for(ll i = 0; i < n; i++)
cin >> a[i];
sort(a,a+n);
ll cur_place = 10;
for(ll i = 10; i < 20; i++){
cout << cur_place <<"th place reached: " << a[i] << " scores" << "\n";
cur_place--;
}
cur_place = 11;
for(ll i = 0; i < 10; i++){
cur_place++;
44
Объяснение:
s = - 1
нц для x от 10 до -3 шаг -2
Действия в цикле:
1) s = s - x
2) s = s + 1
Вывод s * x
x = 10 s = -1
Действия в цикле:
1) s = s - x = -1 - 10 = -11
2) s = s + 1 = -11 + 1 = -10
x = 8 s = -10
Действия в цикле:
1) s = s - x = -10 - 8 = -18
2) s = s + 1 = -18 + 1 = -17
x = 6 s = -17
Действия в цикле:
1) s = s - x = -17 - 6 = -23
2) s = s + 1 = -23 + 1 = -22
x = 4 s = -22
Действия в цикле:
1) s = s - x = -22 - 4 = -26
2) s = s + 1 = -26 + 1 = -25
x = 2 s = -25
Действия в цикле:
1) s = s - x = -25 - 2 = -27
2) s = s + 1 = -27 + 1 = -26
x = 0 s = -26
Действия в цикле:
1) s = s - x = -26 - 0 = -26
2) s = s + 1 = -26 + 1 = -25
x = -2 s = -25
Действия в цикле:
1) s = s - x = -25 - (-2) = -25 + 2 = -23
2) s = s + 1 = -23 + 1 = -22
Цикл закончился
x = -2 s = -22
s * x = -2 * -22 = 44
Вывод 44
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
signed main(){
const ll n = 20;
ll a[n];
for(ll i = 0; i < n; i++)
cin >> a[i];
sort(a,a+n);
ll cur_place = 10;
for(ll i = 10; i < 20; i++){
cout << cur_place <<"th place reached: " << a[i] << " scores" << "\n";
cur_place--;
}
cur_place = 11;
for(ll i = 0; i < 10; i++){
cout << cur_place <<"th place reached: " << a[i] << " scores" << "\n";
cur_place++;
}
}