1.19 Day Simulation

Source: Internet
Author: User

Tag: Its images indicates false click. NET test Problem Tar Center

1.19 Test Questions

1 , P1007 long rope around a nail (https://vijos.org/p/1007)

Background

There are n cylindrical large nails on the plane, the radius is r, and all the nails form a convex polygon.

Now you're going to surround these nails with a rope, and the rope's diameter is negligible.

Describe

Find out the length of the rope

Format input Format

Line 1th two number: integer N (1<=n<=100) and real R.

The next n lines give the coordinates of the center of N Nails in a counterclockwise order
The absolute value of the coordinate does not exceed 100.

Output format

A number, the length of the rope, exactly 2 digits after the decimal point.

Example 1 Sample Input 1
4 1
0.0 0.0
2.0 0.0
2.0 2.0
0.0 2.0
Sample Output 1
Limit

Each test point 1s

Tips

If you're using a more complex method of AC, think about whether there's a simpler way.

2 , Rokua P1276 Tree outside the gate (enhanced version)

Title Description

The gate outside the road originally from the number 0 to L, each numbered location has 1 trees. Every 1 trees are cut down from the number A to B each time by a chopping tree. Even saplings are not spared (note 0 A B, including A and b); Fortunately, trees are planted every time from the number C to D where the hole (the tree has been cut and no saplings or saplings have been cut off) to fill the seedlings (1 C D, including C and D) How many saplings are left at the end of the gate? How many trees are planted and cut down?

Input/output format

Input format:

The first line, L and N, indicates that there are l+1 trees outside the campus, and there are n times to cut trees or plant trees.

The following n rows, chopping trees or tree planting marks and ranges of 3 integers per line.

L (1 <= L <= 10000) and N (1 <= N <= 100)

Output format:

A total of two lines. The number of saplings left outside the gate of the 1th row, and the number of saplings planted in the 2nd row.

Input/Output sample

Input Sample #1 :

10 3

0 2 6

1 1 8

0 5 7

Output Sample #1 :

3

2

Description


3. Food chain (http://acm.nyist.net/JudgeOnline/problem.php?pid=207)

Time limit: Ms | Memory Limit: 65535 KB

Difficulty: 5

Describe

There are three types of animal a,b,c in the animal kingdom, and the food chain of these three animals is an interesting ring. A eat B, B eat c,c eat a.
Existing n animals, numbered with 1-n. Every animal is one of the a,b,c, but we don't know what it is.
Some people describe the food chain relationship between these n animals in two ways:
The first argument is "1 x y", which means that x and Y are homogeneous.
The second argument is "2 x y", which means x eats y.
This person to n animals, with the above two statements, a sentence after sentence to say K sentence, this k sentence some is true, some false. When one sentence satisfies one of the following three, the sentence is a lie, otherwise it is the truth.
1) The current words conflict with some of the preceding words, which is false;
2) The current word in x or y is greater than N, is a lie;
3) The current words say x eats x, is a lie.
Your task is to output the total number of falsehoods according to the given N (1 <= n <= 50,000) and the K-sentence (0 <= K <= 100,000).

Input

The first line is two integers n and K, separated by a single space.
The following k lines each line is three positive integer d,x,y, and two numbers are separated by a space, where D denotes the kind of claim.
If d=1, it means that x and Y are homogeneous.
If d=2, it means x eats y.

Output

There is only one integer that represents the number of false lies.

Sample input

100 7

1 101 1

2 1 2

2 2 3

2 3 3

1 1 3

2 3 1

1 5 5

Sample output

3

/*this question,,, water ah. */#include<iostream>#include<cstdio>#include<cstdlib>#include<cmath>#defineMAXN 1001using namespacestd;intn,cnt;DoubleR,TOT,ANS[MAXN],X[MAXN],Y[MAXN];DoubleSerch (DoubleX1,DoubleY1,DoubleX2,Doubley2) {    Doubleans1= (x2-x1) * (x2-x1); DoubleAns2= (y2-y1) * (y2-y1); Doubleans3=ans1+Ans2; Doubleans4=sqrt (ANS3); returnans4;}intMain () {CIN>>n>>s; CNT=0;  for(intI=1; i<=n;i++) {cin>>x[i]>>Y[i]; CNT++; }     for(intI=1; i<n;i++) {tot+=serch (x[i],y[i],x[i+1],y[i+1]); } tot+=serch (x[n],y[n],x[1],y[1]); Tot+=3.1415*r*2; printf ("%.2lf\n", tot); return 0;}
If the heart is sunny, no words sorrow
/*I was going to write a line-segment tree and write it down to use a loop .*/#include<iostream>#include<cstdio>using namespacestd;intn,m,ans1,ans2,x,y,cnt,j;inttree[100010],v[100010];intFlag;intMain () {scanf ("%d%d",&n,&m);  for(intI=0; i<=n;i++) Tree[i]=1;  for(intI=1; i<=m;i++) {scanf ("%d%d%d",&flag,&x,&y); J=0; if(flag==0)         {             for(j=x;j<=y;j++)            {                if(Tree[j]) {Tree[j]--; if(v[j]==1) ans1++,v[j]=0; }                Else Continue; }        }                if(flag==1)         {             for(j=x;j<=y;j++)            {                if(!tree[j]) tree[j]++,v[j]=1; Else Continue; }        }    }     for(intI=0; i<=n;i++)    {        if(v[i]==1) ans2++; } printf ("%d\n%d\n", ans2,ans1); return 0;}
If the heart is sunny, no words sorrow
#include <bits/stdc++.h>using namespacestd;#defineN 50010intn,k,fa[n*3];intFindintu) {    returnfa[u]==u?fa[u]:fa[u]=find (Fa[u]);}intMain () {Ios::sync_with_stdio (false); Cin.tie (0); CIN>>n>>K; intd,x,y,fx1,fx2,fx3,fy1,fy2,fy3,tot=0;  for(intI=1; i<=n*3; i++) fa[i]=i;  for(intI=1; i<=k; i++) {cin>>d>>x>>y; if(x<1|| x>n| | y<1|| Y>N) {tot++; Continue; }        if(d==2&&x==y) {tot++; Continue; } fx1= Find (x); fx2 = Find (x+n); fx3 = Find (x+2*N); FY1= Find (y); fy2 = Find (y+n); fy3 = Find (y+2*N); if(d==1)        {            if(fx1==fy2| | fx1==fy3) {Tot++; Continue; }            Elsefa[fx1]=fy1,fa[fx2]=fy2,fa[fx3]=Fy3; }        Else        {            if(fx1==fy1| | fx1==fy3) {Tot++; Continue; }            Elsefa[fx1]=fy2,fa[fx2]=fy3,fa[fx3]=fy1; }} cout<<tot; return 0;}
that's not the right question.

1.19 Day Simulation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.