#include <iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
int* p;
int* p1;
int a;
cin >> a;
p = new int[a];
p1 = new int[a];
for (int i = 0; i < a; i++)
{
cin >> p[i];
}
p1[0] = p[0];
int change = 0;
for (int i = 1; i < a; i++)
{
p1[i] = p[i];
int n = i;
while (n>=0 && p1[n]<p1[n-1])
{
change = p1[n - 1];
p1[n - 1] = p1[n];
p1[n] = change;
n--;
}
}
for (int i = 0; i < a; i++)
cout <<(int) p1[i]<<' ';
cout << endl;
delete[]p;
delete[]p1;
}
我用測試執行是ac 我自己測答案也一樣
可是solve又是wa