还是错的

This commit is contained in:
ljcjames 2022-08-15 08:28:33 +08:00
parent ad702f8275
commit 5b0f72e5b3

View File

@ -1,40 +1,45 @@
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int n,m,k;
int gcd(int a,int b)
int n, m, k;
int gcd(int a, int b)
{
while(b!=0)
while (b != 0)
{
int tmp=a;
a=b;
b=tmp%b;
int tmp = a;
a = b;
b = tmp % b;
}
return a;
}
int main()
{
// freopen("bout.txt","w",stdout);
scanf("%d%d%d",&n,&m,&k);
int s=n*m/k*2;
if(n*m*2%k!=0)
// freopen("bout.txt","w",stdout);
scanf("%d%d%d", &n, &m, &k);
printf("%d %d %d \n",n,m,k);
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;
}
int nm=gcd(n,m),n1=n/nm,m1=m/nm;
int x=gcd(k,n1),xy=gcd(k,nm),y=gcd(k,m1);
printf("%d %d %d %d\n",nm,x,y,xy);
if(gcd(x*y*xy,s)==s)
int n1 = gcd(k, n), m1 = gcd(k / n1, m);
int n2 = n / n1, m2 = m / m1;
if (n2 * m2 / 2 * 2 == s) //*2ÒòΪ¿ªÊ¼Ê±s*=2;
{
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
{
printf("NO");
printf("YES\n0 0\n%d 0\n0 %d", n2, m2 * 2);
}
return 0;
}
}