parent
e9ff08a7a6
commit
8479d51fb4
Binary file not shown.
@ -1,22 +1,39 @@
|
|||||||
#include <bits/stdc++.h>
|
#include <bits/stdc++.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
string zshiliu(int u) {
|
||||||
|
char q, p;
|
||||||
|
string s = "";
|
||||||
|
if (u / 16 >= 10)
|
||||||
|
p = 'A' + u / 16 - 10;
|
||||||
|
else
|
||||||
|
p = '0' + u / 16;
|
||||||
|
s += p;
|
||||||
|
if (u % 16 >= 10)
|
||||||
|
q = 'A' + u % 16 - 10;
|
||||||
|
else
|
||||||
|
q = '0' + u % 16;
|
||||||
|
s += q;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
int zshi(string s) {
|
||||||
|
int a = 0;
|
||||||
|
if (s[0] >= 'A' && s[0] <= 'F')
|
||||||
|
a = (s[0] - 'A' + 10) * 16;
|
||||||
|
else if (s[0] >= '0' && s[0] <= '9')
|
||||||
|
a = (s[0] - '0') * 16;
|
||||||
|
|
||||||
int main() {
|
int b = 0;
|
||||||
for (int i = 1;; i++) {
|
if (s[1] >= 'A' && s[1] <= 'F')
|
||||||
int flag = 0;
|
b = (s[1] - 'A' + 10);
|
||||||
int x = i;
|
else if (s[1] >= '0' && s[1] <= '9')
|
||||||
for (int j = 1; j <= 5; j++) {
|
b = (s[1] - '0');
|
||||||
if ((x - 1 <= 0) || (x - 1) % 5 > 0) {
|
|
||||||
flag = 1;
|
return a + b;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
x = (x - 1) / 5 * (5 - 1);
|
|
||||||
}
|
|
||||||
if (flag == 0) {
|
|
||||||
cout << i << endl;
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cout << zshiliu(10) << endl;
|
||||||
|
cout << zshi("FF") << endl;
|
||||||
|
cout << zshi("AA") << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Binary file not shown.
Loading…
Reference in new issue