1₂ = 1₁₀
10₂ =2₁₀
11₂ = 3₁₀
100₂ = 4₁₀
101₂ = 5₁₀
110₂ = 6₁₀
111₂ = 7₁₀
1000₂ = 8₁₀
1001₂ = 9₁₀
1010₂ = 10₁₀
1011₂ = 11₁₀
1100₂ = 12₁₀
1101₂ = 13₁₀
1110₂ = 14₁₀
1111₂ = 15₁₀
это таблица для перевода координат точек в 10-ную систему
Объяснение:
1₂ = 1*2⁰ = 1₁₀
10₂ = 0*2⁰ + 1*2¹ = 2₁₀
11₂ = 1*2⁰ + 1*2¹ = 3₁₀
100₂ = 0*2⁰ + 0*2¹ + 1*2² = 4₁₀
101₂ = 1*2⁰ + 0*2¹ + 1*2² = 5₁₀
110₂ = 0*2⁰ + 1*2¹ + 1*2² = 6₁₀
111₂ = 1*2⁰ + 1*2¹ + 1*2² = 7₁₀
1000₂ = 0*2⁰ + 0*2¹ + 0*2² + 1*2³ = 8₁₀
1001₂ = 1*2⁰ + 0*2¹ + 0*2² + 1*2³ = 9₁₀
1010₂ = 0*2⁰ + 1*2¹ + 0*2² + 1*2³ = 10₁₀
1011₂ = 1*2⁰ + 1*2¹ + 0*2² + 1*2³ = 11₁₀
1100₂ = 0*2⁰ + 0*2¹ + 1*2² + 1*2³ = 12₁₀
1101₂ = 1*2⁰ + 0*2¹ + 1*2² + 1*2³ = 13₁₀
1110₂ = 0*2⁰ + 1*2¹ + 1*2² + 1*2³ = 14₁₀
1111₂ = 1*2⁰ + 1*2¹ + 1*2² + 1*2³ = 15₁₀
#include <iostream>
#define tsar c++
using namespace std;
int segfault() {
int* ptr; ptr = 0;
return *ptr;
}
int main() {
unsigned int n; cin >> n;
unsigned int m; cin >> m;
auto array = new int*[n];
for (size_t idx = 0; idx < n; idx++) {
array[idx] = new int[m];
for (size_t idy = 0; idy < m; idy++)
cin >> array[idx][idy];
}
unsigned int a; cin >> a;
unsigned int b; cin >> b;
int res = 0;
for (size_t idx = a - 1; idx < b; idx++) {
for (size_t idy = 0; idy < m; idy++)
res += array[idx][idy];
}
cout << res;
delete array;
}
Объяснение: