

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
sample output test 3 4 5 nó k hợp đề
b cứ dùng tạm code này, khả năng k AC ngay nma đây đang là code đúng với mô tả của đề nhất
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int xmax = 1e12;
int count(int n, int p)
{
int x = p, cnt = 0;
while (x <= n)
{
cnt = n / x;
x *= p;
}
return cnt;
}
int tryall(int p, int x)
{
int l = 0, r = xmax, m, res = 0;
while (l <= r)
{
m = l + r >> 1;
if (count(m, p) < x) l = m + 1;
else r = m - 1, res = m;
}
return res;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen(".inp", "r", stdin);
freopen(".out", "w", stdout);
// #else
// freopen("553A.inp", "r", stdin);
// freopen("553A.out", "w", stdout);
#endif
int Tc; cin >> Tc;
for (int T = 1; T <= Tc; ++T)
{
cout << "Test #" << T << ":\n";
int n; cin >> n;
vector<int> a(n), res;
for (int &i: a) cin >> i;
int len = 0;
for (int i = 0; i < n; ++i)
{
int j = i+1;
while (j < n && a[j-1] < a[j]) ++j;
if (len < j - i)
{
len = j - i;
res.clear();
}
if (len == j - i) res.push_back(i);
}
cout << len << '\n';
for (int i: res)
{
for (int j = 0; j < len; ++j)
cout << a[i + j] << ' ';
cout << '\n';
}
cout << '\n';
}
}Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
Bảng tin
1
10
1
Cảm ơn anh ạ
286
1975
318
ý tưởng chính xác theo gợi ý nhé
1
10
1
dạ anh