### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 WA on test11 ?!!
Author: Yubin Huang
ID: 068188
Problem: 106
Contest: 0
Date: 2016-04-20 08:24:28

#include<cstdio>
#include<cmath>
using namespace std;
int exgcd(int a,int b,int &x,int &y)
{
if(b==0)
{
x=1;
y=0;
return a;
}
int r=exgcd(b,a%b,x,y);
int t=x;
x=y;
y=t-(a/b)*y;
return r;
}
int main(void)
{
int a,b,c,x,y,k,x1,x2,y1,y2,A,B,min,h,u,low,up;
double q,w,e,i,temp;
while(scanf("%d%d%d%d%d%d%d",&a,&b,&c,&x1,&x2,&y1,&y2)==7)
{
if(x1>x2||y1>y2||(a==0&&b==0&&c!=0))
printf("0n");
else if(a==0&&b==0&&c==0)
{
u=x2-x1+1;
h=y2-y1+1;
min=u*h;
printf("%dn",min);
}
else if(a==0&&b!=0)
{
if(c%b!=0)
printf("0n");
else
{
if(-c/b>=y1&&-c/b<=y2)
{
min=x2-x1+1;
printf("%dn",min);
}
else
printf("0n");
}
}
else if(b==0&&a!=0)
{
if(c%a!=0)
printf("0n");
else
{
if(-c/a>=x1&&-c/a<=x2)
{
min=y2-y1+1;
printf("%dn",min);
}
else
printf("0n");
}
}
else
{
k=exgcd(a,b,x,y);
x=-c*x/k;
y=-c*y/k;
A=b/k;
B=-a/k;
q=(double)(x1-x)/(double)A;
w=(double)(x2-x)/(double)A;
e=(double)(y1-y)/(double)B;
i=(double)(y2-y)/(double)B;
if(-c%k!=0)
printf("0n");
else
{
if(q>w)
{
temp=q;
q=w;
w=temp;
}
if(e>i)
{
temp=e;
e=i;
i=temp;
}
q=ceil(q);
w=floor(w);
e=ceil(e);
i=floor(i);
if(w<e||i<q)
printf("0n");
else
{
if(q<=e)
low=e;
else
low=q;
if(w<=i)
up=w;
else
up=i;
min=up-low+1;
printf("%dn",min);
}
}
}
}
return 0;
}

 Re: WA on test11 ?!!
Author: Yubin Huang
ID: 068188
Problem: 106
Contest: 0
Date: 2016-04-20 08:28:35

can I see text 11 date&#65311;