yeah you are right that there is no main() in the c++ source code.The source code is as follows:
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#pragma comment(linker, “/STACK:60777216”)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define UN(v) SORT(v),v.erase(unique(v.begin(),v.end()),v.end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int inf = 1011111111;
vector<pii> solve(int A){
vector<pii> v;
for(ll i=0;ii<=A;i++){
int j=A-ii;
int k=sqrt(j+0.)+0.1;
if(k*k==j){
v.pb(pii(i,k));
v.pb(pii(-i,k));
v.pb(pii(i,-k));
v.pb(pii(-i,-k));
}
}
return v;
}
class MaxTriangle {
public:
double calculateArea(int A, int B) {
vector<pii> v1=solve(A),v2=solve(B);
double res=-1;
REP(i,v1.size()) REP(j,v2.size()){
double sq=v1*.firstdouble(v2[j].second)-double(v1.second)*v2[j].first;
if(sq<0) sq=-sq;
sq/=2;
if(sq>1e-10) res=max(res,sq);
}
return res;
}
};
Then how to execute the above code without main()?
If I use the following command
g++ -c maxtriangle.cpp -o maxtriangle.o
It just compiles and I am not able to execute it.**