'commit'
This commit is contained in:
47
TangDou/LanQiaoBei/ZhongGaoJi/复习2.md
Normal file
47
TangDou/LanQiaoBei/ZhongGaoJi/复习2.md
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||

|
||||
|
||||
办法:将十六进制向十进制化,**而不是** 将十进制向十六进制转换。上来直接排除$D$(出题人不会太仁慈,否则就直接秒杀了),其它的靠算。
|
||||
|
||||

|
||||
```cpp {.line-numbers}
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 110;
|
||||
int a[N];
|
||||
int main() {
|
||||
cin >> a[0] >> a[1] >> a[2];
|
||||
sort(a, a + 3);
|
||||
cout << a[1] << endl;
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||

|
||||
```cpp {.line-numbers}
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
bool isQm(int x) {
|
||||
int t = x;
|
||||
while (t) {
|
||||
int a = t % 10;
|
||||
if (a > 0 && x % a > 0) return false;
|
||||
t /= 10;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int n, m;
|
||||
cin >> n >> m;
|
||||
int cnt = 0;
|
||||
for (int i = n; i <= m; i++)
|
||||
if (isQm(i)) {
|
||||
cout << i << " ";
|
||||
cnt++;
|
||||
}
|
||||
if (cnt == 0) cout << -1;
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user