Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 1000000 + 10;
#define INF 0x3f3f3f3f
#define clr(x,y) memset(x,y,sizeof x )
typedef long long ll;
#define eps 10e-10
const ll Mod = 1000000007;
typedef pair<ll, ll> P;

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <time.h>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll __int64

//****************************************************************
// Miller_Rabin 算法进行素数测试
//速度快，而且可以判断 <2^63的数
//****************************************************************
const int S=20;//随机算法判定次数，S越大，判错概率越小


//计算 (a*b)%c.   a,b都是long long的数，直接相乘可能溢出的
/*
ll Mult_mod (ll a,ll b,ll c)   //  a,b,c <2^63
{
    a%=c;
    b%=c;
    ll ret=0;
    while (b)
    {
        if (b&1) {ret+=a;ret%=c;}
        a<<=1;
        if (a>=c)a%=c;
        b>>=1;
    }
    return ret;
}*/

ll Mult_mod (ll a,ll b,ll c)  //减法实现比取模速度快
{    //返回(a*b) mod c,a,b,c<2^63
	a%=c;
	b%=c;
	ll ret=0;
	while (b)
	{
		if (b&1)
		{
			ret+=a;
			if (ret>=c) ret-=c;
		}
		a<<=1;
		if (a>=c) a-=c;
		b>>=1;
	}
	return ret;
}

//计算  x^n %c
ll Pow_mod (ll x,ll n,ll mod) //x^n%c
{
    if (n==1) return x%mod;
    x%=mod;
    ll tmp=x;
    ll ret=1;
    while (n)
    {
        if (n&1) ret=Mult_mod(ret,tmp,mod);
        tmp=Mult_mod(tmp,tmp,mod);
        n>>=1;
    }
    return ret;
}

//以a为基,n-1=x*2^t      a^(n-1)=1(mod n)  验证n是不是合数
//一定是合数返回true,不一定返回false
bool Check (ll a,ll n,ll x,ll t)
{
    ll ret=Pow_mod(a,x,n);
    ll last=ret;
    for (int i=1;i<=t;i++)
    {
        ret=Mult_mod(ret,ret,n);
        if(ret==1&&last!=1&&last!=n-1) return true; //合数
        last=ret;
    }
    if (ret!=1) return true;
    return false;
}

// Miller_Rabin()算法素数判定
//是素数返回true.(可能是伪素数，但概率极小)
//合数返回false;

bool Miller_Rabin (ll n)
{
    if (n<2) return false;
    if (n==2) return true;
    if ((n&1)==0) return false;//偶数
    ll x=n-1;
    ll t=0;
    while ((x&1)==0) {x>>=1;t++;}
    for (int i=0;i<S;i++)
    {
        ll a=rand()%(n-1)+1; //rand()需要stdlib.h头文件
        if (Check(a,n,x,t))
            return false;//合数
    }
    return true;
}


//************************************************
//pollard_rho 算法进行质因数分解
//************************************************

ll factor[100];//质因数分解结果（刚返回时是无序的）
int tol;//质因数的个数。数组下标从0开始

ll Gcd (ll a,ll b)
{
    if (a==0) return 1;  //???????
    if (a<0) return Gcd(-a,b);
    while (b)
    {
        ll t=a%b;
        a=b;
        b=t;
    }
    return a;
}

ll Pollard_rho (ll x,ll c)
{
    ll i=1,k=2;
    ll x0=rand()%x;
    ll y=x0;
    while (true)
    {
        i++;
        x0=(Mult_mod(x0,x0,x)+c)%x;
        ll d=Gcd(y-x0,x);
        if (d!=1 && d!=x) return d;
        if (y==x0) return x;
        if (i==k) {y=x0;k+=k;}
    }
}
//对n进行素因子分解
void Findfac (ll n)
{
    if (Miller_Rabin(n)) //素数
    {
        factor[tol++]=n;
        return;
    }
    ll p=n;
    while (p>=n) p=Pollard_rho(p,rand()%(n-1)+1);
    Findfac(p);
    Findfac(n/p);
}

bool ok(ll m,ll n){

    ll q1,q2,q3,q4;

    tol=0;
    Findfac(n);
    ll ans=factor[0];
    for (int i=1;i<tol;i++){
        if (factor[i]>ans && factor[i]<1e9+1)
            ans=factor[i];
    }
    if(ans>1e9 || n/ans>1e9)return 0;
    q1=ans,q2=n/ans;
    tol=0;
    n-=m;
    Findfac(n);
    ans=factor[0];
    for (int i=1;i<tol;i++){
        if (factor[i]>ans && factor[i]<1e9+1)
            ans=factor[i];
    }
    q3=ans,q4=n/ans;
    if(ans>1e9 || n/ans>1e9)return 0;
    printf("0 0 %lld %lld %lld %lld",q1,q4,q3,q2);
    exit(0);
}

int main ()  // Poj 1811 交G++ 比c++ 快很多
{
   // srand(time(NULL));//需要time.h头文件  //POJ上G++要去掉这句话
	int T=1;
	while (T--)
	{
		ll n;
		scanf("%I64d",&n);
		tol=0;
		Findfac(n);
		ll ans=factor[0];
		for (int i=1;i<tol;i++){
			if (factor[i]>ans && factor[i]<1e9+1)
				ans=factor[i];
		}

		if(ans <1e9+1 && n/ans < 1e9+1 ){
            printf("0 0 %lld 0 0 %lld",ans,n/ans);
		}
		else{
            ll m=n;
            ++n;
            while(!ok(m,n))++n;
		}

	}
	return 0;
}


Compiler output:
a.cc:24:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:50:1: note: in expansion of macro 'll'
   50 | ll Mult_mod (ll a,ll b,ll c)  //减法实现比取模速度快
      | ^~
a.cc:24:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:70:1: note: in expansion of macro 'll'
   70 | ll Pow_mod (ll x,ll n,ll mod) //x^n%c
      | ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:87:13: note: in expansion of macro 'll'
   87 | bool Check (ll a,ll n,ll x,ll t)
      |             ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:87:18: note: in expansion of macro 'll'
   87 | bool Check (ll a,ll n,ll x,ll t)
      |                  ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:87:23: note: in expansion of macro 'll'
   87 | bool Check (ll a,ll n,ll x,ll t)
      |                       ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:87:28: note: in expansion of macro 'll'
   87 | bool Check (ll a,ll n,ll x,ll t)
      |                            ^~
a.cc:87:32: error: expression list treated as compound expression in initializer [-fpermissive]
   87 | bool Check (ll a,ll n,ll x,ll t)
      |                                ^
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:105:20: note: in expansion of macro 'll'
  105 | bool Miller_Rabin (ll n)
      |                    ^~
a.cc:24:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:127:1: note: in expansion of macro 'll'
  127 | ll factor[100];//质因数分解结果（刚返回时是无序的）
      | ^~
a.cc:24:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:130:1: note: in expansion of macro 'll'
  130 | ll Gcd (ll a,ll b)
      | ^~
a.cc:24:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:143:1: note: in expansion of macro 'll'
  143 | ll Pollard_rho (ll x,ll c)
      | ^~
a.cc:159:6: error: variable or field 'Findfac' declared void
  159 | void Findfac (ll n)
      |      ^~~~~~~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:159:15: note: in expansion of macro 'll'
  159 | void Findfac (ll n)
      |               ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:172:9: note: in expansion of macro 'll'
  172 | bool ok(ll m,ll n){
      |         ^~
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:172:14: note: in expansion of macro 'll'
  172 | bool ok(ll m,ll n){
      |              ^~
a.cc:172:18: error: expression list treated as compound expression in initializer [-fpermissive]
  172 | bool ok(ll m,ll n){
      |                  ^
a.cc: In function 'int main()':
a.cc:24:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   24 | #define ll __int64
      |            ^~~~~~~
a.cc:205:17: note: in expansion of macro 'll'
  205 |                 ll n;
      |                 ^~
a.cc:206:32: error: 'n' was not declared in this scope
  206 |                 scanf("%I64d",&n);
      |                                ^
a.cc:208:17: error: 'Findfac' was not declared in this scope
  208 |                 Findfac(n);
      |                 ^~~~~~~
a.cc:209:20: error: expected ';' before 'ans'
  209 |                 ll ans=factor[0];
      |                    ^~~
a.cc:211:29: error: 'factor' was not declared in this scope
  211 |                         if (factor[i]>ans && factor[i]<1e9+1)
      |                             ^~~~~~
a.cc:211:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
  211 |                         if (factor[i]>ans && factor[i]<1e9+1)
      |                                       ^~~
      |                                       abs
a.cc:215:20: error: 'ans' was not declared in this scope; did you mean 'abs'?
  215 |                 if(ans <1e9+1 && n/ans < 1e9+1 ){
      |                    ^~~
      |                    abs
a.cc:219:16: error: expected ';' before 'm'
  219 |             ll m=n;
      |                ^
a.cc:221:23: error: 'm' was not declared in this scope
  221 |             while(!ok(m,n))++n;
      |                       ^
a.cc:221:22: error: 'ok' cannot be used as a function
  221 |             while(!ok(m,n))++n;
      |                    ~~^~~~~