SSLOJ 1339 ring
Description–
There is a circle, 1-N N Total number of arranged clockwise in the ring.
You are given a, b, c three numbers, ask the order of a, b, c is clockwise or counterclockwise.
Input–
The first row includes four N, a, b, c positive integers.
Output–
Row of an integer, with 0 representing counterclockwise, one for clockwise.
Sample Input–
5 1 4 2
Sample Output–
0
Notes -
[Explain] Sample
examples below, the order of 1-> 4-> 2 is counterclockwise.
Code -
#include<iostream>
#include<cstdio>
using namespace std;
int n,a,b,c;
bool fot()
{
if (a>b && c<a && c>b)
return 1;
if (a<b && (c<a || c>b))
return 1;
return 0;
}
int main()
{
scanf("%d%d%d%d",&n,&a,&b,&c);
printf("%d",fot());
return 0;
}