A
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << a * 0.2 + b * 0.3 + c * 0.5 << endl;
return 0;
}
B
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, n, ans = 0x3f3f3f3f;
cin >> n;
for (int i = 1; i <= 3; i++) {
cin >> a >> b;
int sum = n / a;
if (n % a != 0) sum++;
int m = sum * b;
if (m < ans) ans = m;
}
cout << ans << endl;
return 0;
}
C
#include <bits/stdc++.h>
using namespace std;
const int N = 5000010;
int a[N];
int main() {
int n, p;
cin >> n >> p;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = n; i > 1; i--) {
a[i] -= a[i - 1];
}
while (p--) {
int x, y, z;
cin >> x >> y >> z;
a[x] += z, a[y + 1] -= z;
}
for (int i = 1; i <= n; i++) {
a[i] += a[i - 1];
}
int mi = 0x3f3f3f3f;
for (int i = 1; i <= n; i++) {
if (a[i] < mi) mi = a[i];
}
cout << mi << endl;
return 0;
}
D
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int e[N][N];
bool book[N][N];
int next_x[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int next_y[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int n, m;
void solve(int x, int y) {
book[x][y] = true;
for (int i = 0; i < 8; i++) {
int tx = x + next_x[i];
int ty = y + next_y[i];
if (tx >= 1 && tx <= n && ty >= 1 && ty <= m) e[tx][ty]++;
}
}
int main() {
cin >> n >> m;
char c;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> c;
if (c == '*') {
solve(i, j);
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (book[i][j])
cout << "*";
else
cout << e[i][j];
}
cout << endl;
}
return 0;
}
E
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d;
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
for (double i = -100.0; i <= 100.0; i += 0.01) {
if (fabs(a * i * i * i + b * i * i + c * i + d) < 1e-8) {
printf("%.2f ", i);
}
}
return 0;
}
F
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s);
int len = s.size();
int sum = len;
for (int i = 0; i < len; i++) {
if (s[i] == ' ') sum--;
}
cout << sum << endl;
return 0;
}
G
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int pr[N], ti[N];
bool book[N];
int main() {
int n, price, time, flag, l = 0, r = 0,sum=0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> flag >> price >> time;
if(flag==0){
pr[r]=price;
ti[r]=time;
r++;
sum+=price;
}else{
while(l<r&&ti[l]+45<time) l++;
int f=1;
for(int j=l;j<r;j++){
if(pr[j]>=price&&book[j]==false){
book[j]=true;
f=0;
break;
}
}
if(f){
sum+=price;
}
}
}
cout<<sum<<endl;
return 0;
}