首页/ 文章/ 打字训练1

打字训练1

2025-06-15 11:51  浏览数:321  来源:xwl2025    

#include <bits/stdc++.h>using namespace std;int max(int a[], int n) {int max = a[0];for (i
nt i = 0; i < n; i++) {if (a[i] > max) {max = a[i];}}return max;}int main() {int n;cin >>
n;int a[n];for (int i = 0; i < n; i++) {cin >> a[i];}cout << max(a, n);return 0;}#include
<bits/stdc++.h>using namespace std;int main() { string s;getline(cin, s);int start
= 0;string result;int i = 0;int j = s.size() - 1;while (s[i] == '*' && i < (s.size() - 1))
{i++;}while (s[j] == '*' && j >= 0) {j--;}for (int a = 0; a < i; a++) {result += '*';}for
(int b = i; b <= j; b++) {if (s[b] != '*') {result += s[b];}}for (int c = j + 1; c < s.si
ze(); c++) {result += '*';}cout << result; return 0;}#include <bits/stdc++.h>using namespa
ce std;string dushu(int n) {string result;string r[10] = {"ling", "yi", "er", "san", "si",
"wu","liu","qi","ba","jiu"};if (n > 19) {result += r[n / 10];result += " shi ";}else if(n>
=10){result+="shi ";}result += r[n % 10];return result;}int main() {int n;cin >> n;cout <<
dushu(n);return 0;}int panduan(int n) {int r = 0;while (n) {if (n % 10 == 7) {r++;}n /= 1
0;}return r;}int main() {int x, y;int count = 0;cin >> x >> y;for (int i = x; i <= y; i++)
{count += panduan(i);}cout << count;return 0;}bool sushu(int n) {if (n <= 1)return false;
if (n == 2)return true;if (n % 2 == 0)return false;for (int i = 3; i * i <= n; i += 2) {if
(n % i == 0) {return false;}}return true;}bool huiwenshu(int n) {int x = n;if (x < 0)retu
rn false;int reversed = 0;while (x != 0) {reversed = reversed * 10 + x % 10;x /= 10;}retur
n reversed == n;}int main() {for (int i = 10; i <= 1000; i++) {if (sushu(i) && huiwenshu(i
)) {cout << i << endl;}}}



声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)