输出答案是对的为什么会WA
查看原帖
输出答案是对的为什么会WA
313219
sudo_rmrf楼主2024/7/7 17:14

输入#4

100
273 963 618 401 579 475 75 85 689 136 336 544 501 576 904 619 774 608 261 838 673 59 189 290 61 369 992 371 484 820 460 462 726 571 333 879 689 349 338 485 944 539 292 128 437 849 772 751 364 569 179 302 413 241 490 462 405 15 11 445 472 730 945 742 423 786 201 842 809 429 929 584 602 675 212 910 94 899 976 178 612 226 207 966 183 997 33 892 578 494 440 259 755 861 756 342 669 228 6 259

输出#4

991

Code

#include <bits/stdc++.h>
using namespace std;
int n, a[99];
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a,a+n+1);
    cout << a[n]-a[1];
}
2024/7/7 17:14
加载中...