社区讨论

80分,求解!!

P1603斯诺登的密码参与者 1已保存回复 0

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
0 条
当前快照
1 份
快照标识符
@lrsyx4x5
此快照首次捕获于
2024/01/25 16:44
2 年前
此快照最后确认于
2024/01/25 19:20
2 年前
查看原帖
CPP
#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???

回复

0 条回复,欢迎继续交流。

正在加载回复...