/* Name: NYOJ--927--The partial sum problem Author: shen_渊 Date: 15/04/17 19:41 Description: DFS,和 NYOJ--1058--dfs--部分和问题 基本一致,递归的i+1注意了,其他没什么 */#include#include using namespace std;void dfs(int);int arr[22],vis[22];int n,k,sum,flag;int main(){// freopen("in.txt","r",stdin); while(cin>>n){ memset(vis,0,sizeof(vis)); memset(arr,0,sizeof(arr)); flag = 0; for(int i=0; i >arr[i]; cin>>k; dfs(0); if(flag)cout<<"Of course,I can!\n"; else cout<<"Sorry,I can't!\n"; } return 0;}void dfs(int ct){ if(sum == k){ flag = 1; return ; } for(int i=ct; i