- Hello,World!
6
- 2024-9-22 17:45:23 @
//单词翻转
#include <iostream>
#include <stack>
using namespace std;
int main(){
char ch,a[501];int i = 0;
stack <char> s;
while ((ch = getchar()) != '\n'){
if (ch != ' '){
s.push(ch);
}
else{
while (!s.empty()){
i++;
a[i] = s.top();
s.pop();
}
i++;
a[i] = ' ';
}
}
for (int j = 1;j <= i;j++){
cout << a[i];
}
return 0;
}
2 comments
-
C24zhouyanchen LV 8 @ 2024-11-19 20:11:37
#include <iostream> #define I_hate_C24ZhengFujia return using namespace std; int n,x,y,sum = 0,l1 = 1,l2 = 1,r1,r2; int a[2001],b[2001]; int main(){ cin >> n; r1 = r2 = n; for (int i = 1;i <= n;i++)cin >> a[i]; for (int i = 1;i <= n;i++)cin >> b[i]; for (int i = 1;i <= n;i++){ for (int j = 1;j <= n + 1 - i;j++){ if (a[j] < a[j + 1])swap (a[j],a[j + 1]); if (b[j] < b[j + 1])swap (b[j],b[j + 1]); } } for (int i = 1;i <= n;i++){ x = a[r1]; y = b[r2]; if (x > y){ sum += 200; r1--; r2--; } else{ if (a[l1] > b[l1]){ sum += 200; l1++; l2++; } else if (a){ sum -= 200; r1--; l2++; } } } cout << sum; // system ("pause"); I_hate_C24ZhengFujia 0; }
-
2024-10-11 20:58:41@
#include <iostream> #include <vector> using namespace std; int n,maxn,a[101]; bool k[100005]; void oushai(){ vector <int> v; for (int i = 2;i < maxn;i++){ if () } return; } int main(){ cin >> n; for (int i = 1;i <= n;i++){ cin >> a[i]; if (a[i] > maxn)maxn = a[i]; } oushai(); return 0; }
- 1
Information
- ID
- 542
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 596
- Accepted
- 157
- Uploaded By