解題心得
沒有心得
程式碼
#include <iostream>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int n, max=0, ans=-999999,temp;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>temp;
if(i==0)
{
max = temp;
continue;
}
if(max-temp>ans)
ans = max-temp;
if(temp>max)
max=temp;
}
cout<<ans<<endl;
}
return 0;
}
沒有留言:
張貼留言