1026

``````#include <iostream>
#include<cmath>
using namespace std;
int main() {
int num1, num2,h,m,s;
cin >> num1 >> num2;
int diff = num2 - num1;
int data = round(diff / 100.0);
h = data / 3600;
m = data % 3600 / 60;
s = data % 3600 % 60;
printf("%02d:%02d:%02d", h, m,s);
}``````

1027

``````#include<iostream>
#include<cmath>
using namespace std;
int main() {
int num;
char sym;
cin >> num >> sym;
int n = 0;
while (num > 2 * pow(n+1, 2) + 1) {//手动计算
n++;
}
int count = n;
for (int i = 0; i < 2 * n +1; i++) {
string output(2*abs(count)+1, sym);
string space(n-abs(count), ' ');
output = space + output;
cout << output<<endl;
count--;
}
cout << num- 2 * pow(n + 1, 2) + 1<<endl;
}``````

1028

``````#include<iostream>
#include<string>
using namespace std;
int main() {
int N;
cin >> N;
string max[2], min[2];
max[1] = "0000/00/00";
min[1] = "9999/99/99";
int count=0;
for (int i = 0; i < N; i++) {
string name, birth;
cin >> name >> birth;
if ("2014/09/06" >= birth && birth >= "1814/09/06") {
if (birth > max[1]) {
max[0] = name;
max[1] = birth;
}
if (birth < min[1]) {
min[0] = name;
min[1] = birth;
}
count++;
}
}
cout << count << " " << min[0] << " " << max[0];
}
``````

1029

``````#include<iostream>
#include<string>
using namespace std;

int main() {
string a;
string b;
getline(cin, a);
getline(cin, b);
for (int i = 0; i < b.size(); i++) {
for (size_t j = 0; j < a.size();) {
if (a[j] == b[i]) {
a.erase(j, 1);
}
else {
j++;
}
}
}
string result;
for (size_t i = 0; i < a.size(); i++) {
a[i] = toupper(a[i]);
if (result.find(a[i]) == string::npos) {
result.push_back(a[i]);
}
}
cout << result;
}
``````

...全文
52 回复 打赏 收藏 转发到动态 举报

264

c++javapython 技术论坛（原bbs） 广东省·深圳市

• 近7日
• 近30日
• 至今