1 条题解
-
0
C++ :
#include <stdio.h> #include <iostream> using namespace std ; class Jack { public: void play() ; protected: int a[ 1005 ] , t , n , s1 , s2 ; }; void Jack::play() { //freopen( "out.txt" , "w" , stdout ) ; cin >> t ; while( t-- ) { s1 = s2 = 0 ; cin >> n ; for( int i = 1 ; i <= n ; i++ ) { scanf( "%d" , &a[ i ] ) ; if( i % 2 ) s1 += a[ i ] ; else s2 += a[ i ] ; } if( s1 != s2 ) { cout << "No\n" ; continue ; } int ok = 0 ; for( int i = 1 ; i <= n / 2 ; i++ ) if( a[ i ] != a[ n - i + 1 ] ) { ok = 1 ; break ; } if( !ok ) cout << "No\n" ; else cout << "Yes\n" ; } } int main() { Jack jack ; jack.play() ; return 0 ; }
- 1
信息
- ID
- 3395
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者