/* * UVA_10930_1.cpp * * Created on: 2013年10月7日 * Author: Administrator */ #include <iostream> #include <cstdio> #include <cstring> using namespace std; int K[30001]; int main(){ int n; int counter = 1; while(scanf("%d",&n)!=EOF){ memset(K,0,sizeof(K)); int i,j; printf("Case #%d:",counter++); int w; bool ok = true; int last = 0; K[0] = 1;//因为数字最小是从1开始的,所以将K[0]设为1,让0变为不可用 for(i = 1 ; i <= n ; ++i){ cin >> w; cout<<" "<<w ; ok &= !K[w] && w > last; for(j = 10000 ; j >= w ; --j){ if(K[j - w]){ K[j] = 1; } } last = w; } cout<<endl; cout<<"This is "<< ((ok)?"":"not ") <<"an A-sequence."; cout<<endl; } return 0; }