如题,WA了第四个点,求调[doge]
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <vector>
#include <queue>
namespace fastIO {
inline int read() {
int res = 0, f = 1;
char ch = getchar();
while( !(ch >= '0' && ch <= '9') ) {
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9') {
res = (res << 1) + (res << 3) + (ch ^ 48);
ch = getchar();
}
return res * f;
}
void write(int x) {
static int sta[35];
int top = 0;
do {
sta[top++] = x % 10;
x /= 10;
} while(x);
while(top) putchar(sta[--top] ^ 48);
}
void writeln(int x) {
write(x);
putchar('\n');
}
}
using namespace std;
using namespace fastIO;
int A, B;
int n = 1;
const int maxn = 5;
int a[maxn];
int t[maxn * 4];
#define lson u << 1
#define rson (u << 1) + 1
void pushup(int u) { t[u] = t[lson] * t[rson]; }
void build(int u, int l, int r) {
if(l == r) t[u] = a[l];
else {
int mid = (l + r) / 2;
build(lson, l, mid);
build(rson, mid + 1, r);
pushup(u);
}
}
void modify(int u, int l, int r, int x ,int y) {
if(l == r) t[u] *= y;
else {
int mid = (l + r) / 2;
if(x > mid) modify(rson, mid + 1, r, x, y);
else modify(lson, l, mid, x, y);
pushup(u);
}
}
int sum(int u, int l, int r, int x, int y) {
if(l == x && r == y) return t[u];
int mid = (l + r) / 2;
if(y <= mid) return sum(lson, l, mid, x, y);
else if(x > mid) return sum(rson, mid + 1, r, x, y);
else return sum(lson, l, mid, x, mid) * sum(rson, mid + 1, r, mid + 1, y);
}
int main() {
cin >> a[1] >> B;
build(1, 1, n);
modify(1, 1, n, 1, B);
cout << sum(1, 1, n, 1, 1);
// printf("\n");
// cout<<"The time used: ";
// printf("%.2lfs",(double)clock()/CLOCKS_PER_SEC);
return 0;
}