Myth丶Peanuts @ 2019-07-16 00:51:36
using namespace std; int main() { vector <long long int> a(2000010); long long int n, m, i, j, min1; cin >> n >> m; for (i = 0; i < n; i++) cin >> a[i]; cout << "0" << endl; min1 = a[0]; for (i = 1; i < n; i++) { if (i < m + 1) { if (min1 > a[i-1]) { min1 = a[i-1]; } cout << min1<<endl; } else { if (min1 < a[i - m - 1]) { min1 = min(a[i - 1], min1); cout << min1 << endl; } else { min1 = a[i - 1]; for (j = i - m; j < i - 2; j++) min1 = min(a[j], min1); cout << min1 << endl; }
}
}
}
by Myth丶Peanuts @ 2019-07-16 00:56:28
using namespace std;
int main()
{
vector <long long int> a(2000010);
long long int n, m, i, j, min1;
cin >> n >> m;
for (i = 0; i < n; i++)
cin >> a[i];
cout << "0" << endl;
min1 = a[0];
for (i = 1; i < n; i++)
{
if (i < m + 1)
{
if (min1 > a[i-1])
{
min1 = a[i-1];
}
cout << min1<<endl;
}
else
{
if (min1 < a[i - m - 1])
{
min1 = min(a[i - 1], min1);
cout << min1 << endl;
}
else
{
min1 = a[i - 1];
for (j = i - m; j < i - 2; j++)
min1 = min(a[j], min1);
cout << min1 << endl;
}
}
}
}
by Myth丶Peanuts @ 2019-07-16 00:56:40
...
by t162 @ 2019-07-16 06:46:08
请不要用Markdown来强调头文件的重要性。
by ynyxxx @ 2019-07-16 07:04:21
希望更丰富的展现?
by Smile_Cindy @ 2019-07-16 07:49:33
请不要用Markdown来强调头文件的重要性。
by 赤黒 @ 2019-07-16 07:57:21
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector <long long int> a(2000010);
long long int n, m, i, j, min1;
cin >> n >> m;
for (i = 0; i < n; i++)
cin >> a[i];
cout << "0" << endl;
min1 = a[0];
for (i = 1; i < n; i++)
{
if (i < m + 1)
{
if (min1 > a[i-1])
{
min1 = a[i-1];
}
cout << min1<<endl;
}
else
{
if (min1 < a[i - m - 1])
{
min1 = min(a[i - 1], min1);
cout << min1 << endl;
}
else
{
min1 = a[i - 1];
for (j = i - m; j < i - 2; j++)
min1 = min(a[j], min1);
cout << min1 << endl;
}
}
}
}
by 赤黒 @ 2019-07-16 07:58:03
@Myth丶Peanuts 我是个好人
by Myth丶Peanuts @ 2019-07-16 14:32:55
@淡水流年 复制黏贴上去就这样了,我也不知道 一开始那个都挤在一起了
by 赤黒 @ 2019-07-16 14:54:00
@Myth丶Peanuts 你不会用Markdown啊,tab键的上面用英文模式按三下,回车,再按三下
就会有上面这个框框了,然后你可以把代码直接贴进去 像这样
#include <...>
using namespace std;
...
...
...
int main()
{
...
...
...
return 0;
}
by Myth丶Peanuts @ 2019-07-16 15:04:10
@淡水流年 好的谢谢大佬