P1488 fat cat games and P1488 fat cat games
Description
The wild cat and fat man, collectively referred to as fat cat, are classmates in a class. They are also masters of mathematics, so it is not surprising that they often discuss mathematical issues together. Once, the wild cat encountered an interesting geometric game question and showed it to the fat man. The game requires a convex polygon with n vertices. The n-3 of this convex polygon divides the Polygon into N-2 triangles, where the diagonal lines of the n-3 intersect the polygon vertices. One of the triangles is dyed black, and the rest are white. The two sides play the game in turn. When it is his turn, he must cut a triangle from the polygon along the drawn diagonal. Cut the black triangle to win. I think it is really interesting to be a fat man. It's better to play together. If the game starts with a wild cat, does the wild cat have a winning strategy? Please write a program to help the wild cat calculate it.
Input/Output Format
Input Format:
The first behavior is an integer n (4 <= n <= 50000), indicating the number of vertices in the polygon. The vertices in the polygon are clockwise numbered from 0 to n-1. The following N-2 line describes the triangle that forms a polygon. Line I + 1 (1 <= I <= n-2) has three spaces separated non-negative integers a, B, c, they are vertex numbers of the I triangle. The first triangle is black.
Output Format:
There is only one row. If a wild cat has a winning strategy, JMcat Win is output; otherwise, PZ Win is output. (Case sensitive and space sensitive)
Input and Output sample
Input example #1:
60 1 22 4 34 2 00 5 4
Output sample #1:
JMcat Win
Description
1 s for each test point
If the line segment connecting any two points of a polygon is completely contained in the polygon, the polygon is called a convex polygon.
This question has a bug ,,
5
0 1 4
1 2 3
1 4 3
The program running results in the question solution are different.
And I think I wrote it right. The result is 70 points ,,,
1 include <iostream> 2 # include <cstdio> 3 # include <cstring> 4 # include <cmath> 5 # include <algorithm> 6 using namespace std; 7 int read (int & n) 8 {9 char c = '-'; int x = 0; 10 while (c <'0' | c> '9 ') c = getchar (); 11 while (c> = '0' & c <= '9') 12 {13 x = x * 10 + (c-48 ); 14 c = getchar (); 15} 16 n = x; 17} 18 int n; 19 int a [4]; 20 int main () 21 {22 read (n ); 23 read (a [1]); read (a [2]); read (a [3]); 24 sort (a + 1, a + 4 ); 25 if (n % 2 = 0) 26 printf ("JMcat Win"); 27 else if (a [3]-a [2]) = (a [2]-a [1]) 28 printf ("JMcat Win"); 29 else30 printf ("PZ Win"); 31 return 0; 32}I think it's correct, but it's 70 points.
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include<algorithm> 6 using namespace std; 7 int read(int & n) 8 { 9 char c='-';int x=0;10 while(c<'0'||c>'9')c=getchar();11 while(c>='0'&&c<='9')12 {13 x=x*10+(c-48);14 c=getchar();15 }16 n=x;17 }18 int n;19 int a[4];20 int main()21 {22 read(n);23 read(a[1]);read(a[2]);read(a[3]);24 sort(a+1,a+4);25 if(n%2==0)26 printf("JMcat Win");27 else 28 {29 int count = 0;30 if (abs(a[1]-a[2])==1) count++;31 if (abs(a[1]-a[3])==1) count++;32 if (abs(a[2]-a[3])==1) count++;33 if (count==2) 34 cout<<"JMcat Win\n";35 else36 printf("PZ Win");37 }38 39 return 0;40 }