#include<iostream> #include<vector> using namespace std; int main () { vector<int> v; vector<int>::iterator iter1; vector<int>::iterator iter2; int s,tmp; cin>>s; while (cin>>tmp) { v.push_back(tmp); } iter2=v.end(); for(iter1=v.begin();iter1!=v.end();iter1++) { for(iter2=v.end();iter2!=v.begin();iter2--) { if(*iter1+*iter2==s&&iter1<iter2) { if(*iter1<*iter2) cout<<*iter1<<" + "<<*iter2<<" = "<<s<<endl; } } } }
by: 发表于:2017-09-01 09:53:12 顶(0) | 踩(0) 回复
??
回复评论