摘要: 给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。 输入 第1行:用空格隔开的2个数,K N,N为A数组的长度。(2 阅读全文
posted @ 2019-07-19 20:59 YF-1994 阅读(438) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; #define N 1010 int dp[N][N]; char c; int main() { char a[N]; char b[N]; scanf("%s%s",a,b); int la=strlen(a); int lb=strlen... 阅读全文
posted @ 2019-07-19 20:00 YF-1994 阅读(525) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; bool cmp(string &s, string &t){ if(s.size()!=t.size())return s.size()>t.size(); for(int i=0;it[i]; } return true; } vector... 阅读全文
posted @ 2019-07-19 19:45 YF-1994 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int n; vector get_yue(int x){ vectorres; for(int i=1;i>n; for(int i=0,a;i>a; auto p=get_yue(a); for(auto x:p)cout<<x<<' ';... 阅读全文
posted @ 2019-07-19 14:06 YF-1994 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; const int N=10000001; int prim[N],cnt; bool st[N]; int primcnt(int n){ for(int i=2;i<=n;i++){ if(!st[i])prim[c 阅读全文
posted @ 2019-07-19 13:59 YF-1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int n; void get_prim(int x){ for(int i=2;i1)cout>n; for(int i=0,a;i>a; get_prim(a); } return 0; } 阅读全文
posted @ 2019-07-19 13:58 YF-1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int n; bool prim(int x){ if(x>n; for(int i=0,a;i>a; if(prim(a))cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; } 阅读全文
posted @ 2019-07-19 13:50 YF-1994 阅读(415) 评论(0) 推荐(0) 编辑