[U]3.4.3 皮克定理

/*
ID:bysen
LANG:C++
PROG:fence9
*/
#include<stdio.h>
#include<algorithm>
using namespace std;

int gcd( int a,int b )
{
 	if( b==0 ) return a;
 	else return gcd( b,a%b );
}

int main()
{
 	freopen( "fence9.in","r",stdin );
 	freopen( "fence9.out","w",stdout );
 	int n,m,p;
 	scanf( "%d %d %d",&n,&m,&p );
 	
 	int S=p*m/2;
 	int L=gcd(p,0)+gcd(n,m)+gcd(abs(m),abs(p-n));
 	printf( "%d\n",S-L/2+1 );
 	return 0;
}

你可能感兴趣的:([U]3.4.3 皮克定理)