Francium_ @ 2023-08-14 12:14:11
rt,求调 为什么#2输出为10964而不为1964??
#include <bits/stdc++.h>
using namespace std;
struct aaa {
string num;
} a[20];
int poww[30] = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 00, 21, 44, 69, 96, 25, 56, 89, 24, 61, 0, 1, 4, 1, 1, 4, 9};
string A[30] = {"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 b[20];
map<string, int>mp;
int main() {
int x = 1, tmp;
string s;
for (int i = 0; i < 6; i++) {
cin >> s;
if (s[s.size() - 1] == '.')
s = s.substr(0, s.size() - 1);
a[i + 1].num = s;
}
tmp = 1;
for (int i = 0; i <= 20; i++)
mp[A[i]] = i ;
for (int i = 21; i < 30; i++) {
mp[A[i]] = sqrt(poww[i]);
}
for (int i = 1; i <= 6; i++) {
if (mp[a[i].num]) {
b[tmp] = poww[mp[a[i].num]];
tmp++;
}
}
if (tmp == 1) {
cout << 0;
return 0;
}
sort(b + 1, b + tmp);
for (int i = 1; i < tmp; i++)
cout << b[i] % 100;
return 0;
}
by JamesZhan @ 2023-08-14 12:49:11
@Dbr666yhdkw 因为只有最前面一位有0才去0,其他位不去0.有帮助可以互关一下吗QWQ
by Francium_ @ 2023-08-14 13:58:01
@JamesZhan O,懂了,蟹蟹