#include using namespace std; int main() { cout << "$1 = 1" << endl << "$2 = 1" << endl << "$3 = 1" << endl; int num = 4; cout << "$" << num << " = H * 11" << endl; cout << "$" << num << " = $" << num << " + W" << endl; for (int h = 1; h <= 10; h++) { for (int w = 1; w <= 10; w++) { int k = h * 11 + w; cout << "if($" << num << " == " << k << ")" << endl; int tot = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { tot += i * w + j; } } cout << "\t$3 = " << tot << endl; cout << "end" << endl; } } for (int h = 1; h <= 10; h++) { for (int w = 1; w <= 10; w++) { for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cout << "$" << num << " = H * 11" << endl; cout << "$" << num << " = $" << num << " + W" << endl; cout << "$" << num << " = $" << num << " * 101" << endl; cout << "$" << num << " = $" << num << " + a[" << i << "," << j << "]" << endl; num++; cout << "$" << num << " = " << h << " * 11" << endl; cout << "$" << num << " = $" << num << " + " << w << endl; cout << "$" << num << " = $" << num << " * 101" << endl; cout << "$" << num << " = $" << num << " + b[" << i << "," << j << "]" << endl; num++; cout << "if($" << num - 2 << " == $" << num - 1 << ")" << endl; cout << "\t$3 = $3 - " << j << endl; cout << "\t$" << num << " = W * " << i << endl; cout << "\t$3 = $3 - $" << num << endl; num++; cout << "end" << endl; } } } } cout << "$1 = $3 / W" << endl; cout << "$2 = $3 % W" << endl; cout << "return($1,$2)" << endl; return 0; }