还是错的
This commit is contained in:
parent
ad702f8275
commit
5b0f72e5b3
@ -1,40 +1,45 @@
|
|||||||
#include<iostream>
|
#include <iostream>
|
||||||
#include<cstdio>
|
#include <cstdio>
|
||||||
#include<algorithm>
|
#include <algorithm>
|
||||||
#include<cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
int n,m,k;
|
int n, m, k;
|
||||||
int gcd(int a,int b)
|
int gcd(int a, int b)
|
||||||
{
|
{
|
||||||
while(b!=0)
|
while (b != 0)
|
||||||
{
|
{
|
||||||
int tmp=a;
|
int tmp = a;
|
||||||
a=b;
|
a = b;
|
||||||
b=tmp%b;
|
b = tmp % b;
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// freopen("bout.txt","w",stdout);
|
// freopen("bout.txt","w",stdout);
|
||||||
|
|
||||||
scanf("%d%d%d",&n,&m,&k);
|
scanf("%d%d%d", &n, &m, &k);
|
||||||
int s=n*m/k*2;
|
printf("%d %d %d \n",n,m,k);
|
||||||
if(n*m*2%k!=0)
|
int s = n * m / k * 2;
|
||||||
|
if (n * m * 2 % k != 0)
|
||||||
{
|
{
|
||||||
printf("NO");
|
printf("%d %d %d %d \n",n,m,k,n * m * 2 % k);
|
||||||
|
printf("\\NO");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int nm=gcd(n,m),n1=n/nm,m1=m/nm;
|
int n1 = gcd(k, n), m1 = gcd(k / n1, m);
|
||||||
int x=gcd(k,n1),xy=gcd(k,nm),y=gcd(k,m1);
|
int n2 = n / n1, m2 = m / m1;
|
||||||
printf("%d %d %d %d\n",nm,x,y,xy);
|
if (n2 * m2 / 2 * 2 == s) //*2ÒòΪ¿ªÊ¼Ê±s*=2;
|
||||||
if(gcd(x*y*xy,s)==s)
|
|
||||||
{
|
{
|
||||||
printf("YES\n0 0\n%d 0\n0 %d\n",x*xy,y);
|
printf("YES\n0 0\n%d 0\n0 %d", n2, m2);
|
||||||
|
}
|
||||||
|
else if (n2 * 2 <= n)
|
||||||
|
{
|
||||||
|
printf("YES\n0 0\n%d 0\n0 %d", n2 * 2, m2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("NO");
|
printf("YES\n0 0\n%d 0\n0 %d", n2, m2 * 2);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user