#include<iostream> using namespace std; int main() { int index = 0; string paper_type; int A0[2] = { 1189, 841 }, A1[2] = {}, A2[2] = {}, A3[2] = {}, A4[2] = {}, A5[2] = {}, A6[2] = {}, A7[2] = {}, A8[2] = {}, A9[2] = {}; int* arr[10] = { A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 }; char arr_names[10][2] = { {'A', '0'}, {'A', '1'}, {'A', '2'}, {'A', '3'}, {'A', '4'}, {'A', '5'}, {'A', '6'}, {'A', '7'}, {'A', '8'}, {'A', '9'} }; for (int i = 1; i < 10; i++) { arr[i][1] = arr[i - 1][0] / 2; // AX短边是A(X-1)长边的一半; arr[i][0] = arr[i - 1][1]; // AX长边是A(X-1)的短边; } cin >> paper_type; for (int j = 0; j < 10; j++) { if (paper_type == string(arr_names[j], 2)) { index = j; break; } } for (int k = 0; k < 2; k++) { cout << arr[index][k] << endl; } return 0; }
解题思路:
注意事项:
参考代码:
0.0分
0 人评分