80分,求解!!
查看原帖
80分,求解!!
1241334
wangderui111楼主2024/1/25 16:44
#include<bits/stdc++.h>
using namespace std;
string temp[27] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "a", "both", "another", "first", "second", "third"};
int tempf[27] = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 0, 21, 44, 69, 96, 25, 56, 89, 24, 61, 0, 1, 4, 1, 1, 4, 9};
string a[6];
int main() {
	bool ll = false, lll = true;
	cin >> a[0];
	cin >> a[1];
	cin >> a[2];
	cin >> a[3];
	cin >> a[4];
	cin >> a[5];

	for (int i = 0; i < 6; i++) {
		for (int j = 0; j < 27; j++) {
			if (a[i] == temp[j] && ll == false) {
				cout << tempf[j];
				ll = true;
				continue;
			} else if (a[i] == temp[j]) {
				printf("%02d", tempf[j]);
				ll = true;
				continue;
			}
		}
	}
	if (ll == false) {
		cout << 0;
	}
	return 0;
}

第一个事例错了,为啥不能加00???

2024/1/25 16:44
加载中...