HDU4524+水题
简单。
1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 1000006; 4 int a[ maxn ]; 5 int main(){ 6 int ca; 7 scanf("%d",&ca); 8 while( ca-- ){ 9 int n; 10 scanf("%d",&n); 11 for( int i=0;i<n;i++ ){ 12 scanf("%d",&a[ i ]); 13 } 14 int flag = 1; 15 for( int i=0;i<n-1;i++ ){ 16 if( a[ i+1 ]>=a[ i ] ){ 17 a[ i+1 ] -= a[ i ]; 18 a[ i ] = 0; 19 } 20 else { 21 flag = -1; 22 break; 23 } 24 } 25 if( a[ n-1 ]!=0 ) flag = -1; 26 if( flag==-1 ) printf("I will never go out T_T\n"); 27 else printf("yeah~ I escaped ^_^\n"); 28 } 29 return 0; 30 }
keep moving...