#include<iostream> #include<cstdio> #include<algorithm> #include<set> #include<vector> #include<utility> #include<map> #include<list> #include<queue> #include<stack> #include<cstring> #include<string> #include<cmath> using namespace std; vector<int> V; map<int,int> M; int res = -1; set<int> S; int x,y,a,b; struct node { int x,y; node(){} node(int x,int y):x(x),y(y){} }; bool operator < (const node &n1, const node &n2) { return ((n1.x != n2.x) ? n1.x < n2.x : n1.y < n2.y); } node N[100000]; int main() { /* freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); */ cin >> x >> y >> a >> b; for(int i=b;i<=y;i++) { for(int j = (i+1>=a?i+1:a);j<=x;j++) { res++; N[res] = node(j,i); } } sort(N,N+res+1); //int res = (int)M.size(); //if(res== -1) // cout << 0 << endl; //else //{ printf("%d\n",res+1); /* map<int,int>::iterator it; for(it = M.begin();it!=M.end(); it++) printf("%d %d\n",(*it).first,(*it).second); */ for(int i=0;i <= res; i++) printf("%d %d\n",N[i].x,N[i].y); //} return 0; }
Thứ Hai, 12 tháng 11, 2012
Problem Heads or Tails
Link: http://codeforces.com/problemset/problem/242/A
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét