提交时间:2023-12-07 13:28:16
运行 ID: 114369
# include <bits/stdc++.h> using namespace std ; int a [114514] ; int main ( ) { int sze ; cin >> sze ; for ( int i = 1 ; i <= sze ; i ++ ) { cin >> a [i] ; } while ( sze > 1 ) { for ( int i = 1 ; i <= 2 ; i ++ ) { for ( int j = 1 ; j < sze - i + 1 ; j ++ ) { if ( a [j] > a [j + 1] ) { swap ( a [j] , a [j + 1] ) ; } } } a [sze - 2] = a [sze - 1] - a [sze - 2] ; sze -- ; } cout << a [1] << endl ; return 0 ; }