昨晚打得小号,虽然很菜,可是还是涨了些rating

A. Arpa and a research in Mexican wave
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Arpa is researching the Mexican wave.

There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.

  • At time 1, the first spectator stands.
  • At time 2, the second spectator stands.
  • ...
  • At time k, the k-th spectator stands.
  • At time k + 1, the (k + 1)-th spectator stands and the first spectator sits.
  • At time k + 2, the (k + 2)-th spectator stands and the second spectator sits.
  • ...
  • At time n, the n-th spectator stands and the (n - k)-th spectator sits.
  • At time n + 1, the (n + 1 - k)-th spectator sits.
  • ...
  • At time n + k, the n-th spectator sits.

Arpa wants to know how many spectators are standing at time t.

Input

The first line contains three integers nkt (1 ≤ n ≤ 109, 1 ≤ k ≤ n, 1 ≤ t < n + k).

Output

Print single integer: how many spectators are standing at time t.

Examples
input
  1. 10 5 3
output
  1. 3
input
  1. 10 5 7
output
  1. 5
input
  1. 10 5 12
output
  1. 3
Note

In the following a sitting spectator is represented as -, a standing spectator is represented as ^.

  • At t = 0  ----------  number of standing spectators = 0.
  • At t = 1  ^---------  number of standing spectators = 1.
  • At t = 2  ^^--------  number of standing spectators = 2.
  • At t = 3  ^^^-------  number of standing spectators = 3.
  • At t = 4  ^^^^------  number of standing spectators = 4.
  • At t = 5  ^^^^^-----  number of standing spectators = 5.
  • At t = 6  -^^^^^----  number of standing spectators = 5.
  • At t = 7  --^^^^^---  number of standing spectators = 5.
  • At t = 8  ---^^^^^--  number of standing spectators = 5.
  • At t = 9  ----^^^^^-  number of standing spectators = 5.
  • At t = 10 -----^^^^^  number of standing spectators = 5.
  • At t = 11 ------^^^^  number of standing spectators = 4.
  • At t = 12 -------^^^  number of standing spectators = 3.
  • At t = 13 --------^^  number of standing spectators = 2.
  • At t = 14 ---------^  number of standing spectators = 1.
  • At t = 15 ----------  number of standing spectators = 0.

这个题我还看了两三分钟,发现就是个分段函数,结论很明显

不过我竟脑残打错了字母,wa了一发

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long n,k,t;
  6. cin>>n>>k>>t;
  7. if(t<=k)
  8. cout<<t<<endl;
  9. else if(t>=n)
  10. cout<<n+k-t<<endl;
  11. else cout<<k<<endl;
  12. return ;
  13. }
B. Arpa and an exam about geometry
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Arpa is taking a geometry exam. Here is the last problem of the exam.

You are given three points a, b, c.

Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.

Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not.

Input

The only line contains six integers ax, ay, bx, by, cx, cy (|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 109). It's guaranteed that the points are distinct.

Output

Print "Yes" if the problem has a solution, "No" otherwise.

You can print each letter in any case (upper or lower).

Examples
input
  1. 0 1 1 1 1 0
output
  1. Yes
input
  1. 1 1 0 0 1000 1000
output
  1. No
Note

In the first sample test, rotate the page around (0.5, 0.5) by .

In the second sample test, you can't find any solution.

这个也简单,给你三个点,让你判断a,b能不能绕着一个点转到b,c的位置,明显就是等腰三角形嘛

但是不能共线,这个自己也fst了,比较好的做法是判断b不是中点

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long ax,ay,bx,by,cx,cy;
  6. cin>>ax>>ay>>bx>>by>>cx>>cy;
  7. long long a=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
  8. long long b=(cx-bx)*(cx-bx)+(cy-by)*(cy-by);
  9. if(a==b&&(cx+ax!=*bx||cy+ay!=*by))
  10. puts("Yes");
  11. else puts("No");
  12. return ;
  13. }

我现在发现是我斜率公式交换的时候写错了啊,改了字母就过了。我好菜啊

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long ax,ay,bx,by,cx,cy;
  6. cin>>ax>>ay>>bx>>by>>cx>>cy;
  7. if((ax-bx)*(ax-bx)+(ay-by)*(ay-by)==(cx-bx)*(cx-bx)+(cy-by)*(cy-by)&&(cy-ay)*(bx-ax)!=(by-ay)*(cx-ax))
  8. puts("Yes");
  9. else puts("No");
  10. return ;
  11. }
C. Five Dimensional Points
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.

We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors  and  is acute (i.e. strictly less than ). Otherwise, the point is called good.

The angle between vectors  and  in 5-dimensional space is defined as , where  is the scalar product and  is length of .

Given the list of points, print the indices of the good points in ascending order.

Input

The first line of input contains a single integer n (1 ≤ n ≤ 103) — the number of points.

The next n lines of input contain five integers ai, bi, ci, di, ei (|ai|, |bi|, |ci|, |di|, |ei| ≤ 103)  — the coordinates of the i-th point. All points are distinct.

Output

First, print a single integer k — the number of good points.

Then, print k integers, each on their own line — the indices of the good points in ascending order.

Examples
input
  1. 6
    0 0 0 0 0
    1 0 0 0 0
    0 1 0 0 0
    0 0 1 0 0
    0 0 0 1 0
    0 0 0 0 1
output
  1. 1
    1
input
  1. 3
    0 0 1 2 0
    0 0 9 2 0
    0 0 5 9 0
output
  1. 0
Note

In the first sample, the first point forms exactly a  angle with all other pairs of points, so it is good.

In the second sample, along the cd plane, we can see the points look as follows:

We can see that all angles here are acute, so no points are good.

给了五维坐标系,拿出了累似二维的东西,但是1e9可以跑下来么,这时候qls给了一个243的结论牛逼啊

这个题自己写错了break条件导致写了太久了,虽然中途还看了B,但是这个题分数已经掉光了

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int N=1e3+;
  4. double PI=acos(0.0);
  5. struct Point
  6. {
  7. int a,b,c,d,e;
  8. } f[];
  9. int main()
  10. {
  11. int n;
  12. scanf("%d",&n);
  13. if(n>)
  14. printf("0\n");
  15. else
  16. {
  17. for(int i=; i<n; i++)
  18. scanf("%d%d%d%d%d",&f[i].a,&f[i].b,&f[i].c,&f[i].d,&f[i].e);
  19. vector<int>V;
  20. for(int i=; i<n; i++)
  21. {
  22. int ff=;
  23. for(int j=; j<n; j++)
  24. {
  25.  
  26. Point x;
  27. if(j==i)continue;
  28. x.a=f[j].a-f[i].a;
  29. x.b=f[j].b-f[i].b;
  30. x.c=f[j].c-f[i].c;
  31. x.d=f[j].d-f[i].d;
  32. x.e=f[j].e-f[i].e;
  33. for(int k=; k<n; k++)
  34. {
  35. Point y;
  36. if(j==i||k==j)continue;
  37. y.a=f[k].a-f[i].a;
  38. y.b=f[k].b-f[i].b;
  39. y.c=f[k].c-f[i].c;
  40. y.d=f[k].d-f[i].d;
  41. y.e=f[k].e-f[i].e;
  42. int z=y.a*x.a+y.b*x.b+y.c*x.c
  43. +y.d*x.d+y.e*x.e;
  44. if(z>)
  45. {
  46. ff=;
  47. break;
  48. }
  49. }
  50. if(ff)break;
  51. }
  52. if(!ff)
  53. V.push_back(i+);
  54. }
  55. printf("%d\n",(int)V.size());
  56. for(int i=; i<(int)V.size(); i++)
  57. printf("%d\n",V[i]);
  58. }
  59. return ;
  60. }

Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)的更多相关文章

  1. D. Arpa and a list of numbers Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)

    http://codeforces.com/contest/851/problem/D 分区间操作 #include <cstdio> #include <cstdlib> # ...

  2. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)ABCD

    A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megaby ...

  3. Codeforces Round #432 (Div. 1, based on IndiaHacks Final Round 2017) D. Tournament Construction(dp + 构造)

    题意 一个竞赛图的度数集合是由该竞赛图中每个点的出度所构成的集合. 现给定一个 \(m\) 个元素的集合,第 \(i\) 个元素是 \(a_i\) .(此处集合已经去重) 判断其是否是一个竞赛图的度数 ...

  4. 【前缀和】【枚举倍数】 Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D. Arpa and a list of numbers

    题意:给你n个数,一次操作可以选一个数delete,代价为x:或者选一个数+1,代价y.你可以进行这两种操作任意次,让你在最小的代价下,使得所有数的GCD不为1(如果全删光也视作合法). 我们从1到m ...

  5. 【推导】【暴力】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C. Five Dimensional Points

    题意:给你五维空间内n个点,问你有多少个点不是坏点. 坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点. 结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个 ...

  6. 【推导】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B. Arpa and an exam about geometry

    题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置. 只要A,B,C构成等腰三角形,且B为上顶点.那么其外接圆圆心即 ...

  7. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D

    Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and g ...

  8. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C

    You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two poi ...

  9. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B

    Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a,  ...

  10. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A

    Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. Th ...

随机推荐

  1. xml文件解析和序列化

    转载:http://blog.csdn.net/liuhe688/article/details/6415593 XmlPullParser parser = Xml.newPullParser(); ...

  2. HDU 1693 Eat the Trees (插头DP)

    题意:给一个n*m的矩阵,为1时代表空格子,为0时代表障碍格子,问如果不经过障碍格子,可以画一至多个圆的话,有多少种方案?(n<12,m<12) 思路: 这题不需要用到最小表示法以及括号表 ...

  3. COGS 1427. zwei

    ★☆   输入文件:zwei.in   输出文件:zwei.out   简单对比时间限制:1 s   内存限制:256 MB ‘‘ [样例输入] 5 5 1 2 3 4 5 1 1 3 1 3 5 0 ...

  4. jquery分页组件(每页显示多少条)

    /** * 功能说明:jPager 分页插件 * 参数说明:pages:[] 分页的控件个数 @id:显示分页的div ID,@showSelectPage: 是否显示当前分页的条目过滤下拉框 * @ ...

  5. 如何解决源码安装软件中make时一直重复打印configure信息

    在通过源码安装软件时,会出现执行./configure后再make时总是重复打印configure的信息,无法进入下一阶段的安装. 主要原因是系统当前的时间与实际时间不一致,特别是在虚拟机上经常会出现 ...

  6. labview密码忘记怎么办,如何破解labview密码,vi密码md5码破解重置

    labview密码忘记了或者需要破解labview密码,可以找到vi文件的md5码,把里面的md5码拿到网站http://cmd5.la解密就可以了. 把vi文件的32位md5码放到网站cmd5.la ...

  7. 提取循环中包含continue的语句封装成方法

    demo如下: private void button1_Click(object sender, EventArgs e) { ;i<;i++) { if (!a(i)) { continue ...

  8. 转过来的Xpath语法

    XPath 是XML的查询语言,和SQL的角色很类似.以下面XML为例,介绍XPath 的语法.   <?xml version="1.0" encoding="I ...

  9. layui 数据table隐藏表头

    $('.layui-table .layui-table-cell > span').css({'font-weight': 'bold'});//表头字体样式 /*$('th').css({' ...

  10. PAT (Basic Level) Practise (中文)-1035. 插入与归并(25)

    PAT (Basic Level) Practise (中文)-1035. 插入与归并(25)   http://www.patest.cn/contests/pat-b-practise/1035 ...