0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 21:56:28 +00:00

38793 第三届“传智杯”全国大学生计算机大赛(初赛同步)

T160507: R43986442
T160508: R44005001
T160509: R44020690
This commit is contained in:
Baoshuo Ren 2020-12-20 18:36:12 +08:00 committed by Baoshuo Ren
parent 338fd50cca
commit 0b863a7ccf
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
3 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, v, a, ans = 0;
cin >> n >> v >> m >> a;
for (int i = 1; i <= n; i++) {
ans += v;
if (i % m == 0) v += a;
}
cout << ans << endl;
return 0;
}

View File

@ -0,0 +1,28 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int score;
double gpa = 0.0;
cin >> score;
if (score >= 90) {
gpa = 4.0;
}
else if (60 <= score && score <= 89) {
gpa = 4.0 - (90 - score) * 0.1;
}
else {
if (floor(sqrt(score) * 10.0) >= 90.0) {
gpa = 4.0;
}
else if (floor(sqrt(score) * 10.0) >= 60.0) {
gpa = 4.0 - (90.0 - floor(sqrt(score) * 10.0)) * 0.1;
}
else {
gpa = 0.0;
}
}
cout << fixed << setprecision(1) << gpa << endl;
return 0;
}

View File

@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;
struct node {
int i, t, k;
} p[500005];
bool cmp(node a, node b) {
return a.t * a.k == b.t * b.k ? a.t == b.t ? a.i < b.i : a.t > b.t : a.t * a.k > b.t * b.k;
}
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> p[i].t >> p[i].k;
p[i].i = i;
}
sort(p + 1, p + 1 + n, cmp);
for (int i = 1; i <= n; i++) {
cout << p[i].i << ' ';
}
cout << endl;
return 0;
}