Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) 
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
10 5 3
  output
3
  input
10 5 7
  output
5
  input
10 5 12
  output
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.

题目大意:第T个时刻第T-k个人坐下,问T时刻站着多少人。

代码:

#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std; #define LL long long inline int read(){
int x=0,f=1;char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
for(;isdigit(c);c=getchar()) x=x*10+c-'0';
return x*f;
}
const int INF=9999999;
const int MAXN=100000; int N,K,T; int main(){
N=read(),K=read(),T=read();
if(T>=K&&T<=N) printf("%d\n",K);
else if(T>N) printf("%d\n",K-(T-N));
else printf("%d\n",T);
return 0;
}
 
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
0 1 1 1 1 0
  output
Yes
  input
1 1 0 0 1000 1000
  output
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,C,问是否能通过选定一个点为中心点旋转a°使得A在B位置,B在C位置。

试题分析:只需要判断AB==BC,以及ABC是否在一条直线上就AC了……

     “你距离正解,只有一个long long的距离”

代码:

#include<iostream>
#include<cmath>
using namespace std;
#define LL long long
inline long long read(){
long long x=0,f=1;char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
for(;isdigit(c);c=getchar()) x=x*10+c-'0';
return x*f;
}
long long Ax,Ay,Bx,By,Cx,Cy;
double dist(long long x2,long long y2,long long x1,long long y1){
double xp=(x2-x1);double yp=(y2-y1);
return (double) sqrt(xp*xp+yp*yp);
}
int main(){
Ax=read(),Ay=read(),Bx=read(),By=read(),Cx=read(),Cy=read();
//if(Ax==Cx&&Ay==Cy){puts("Yes");}
if(dist(Ax,Ay,Bx,By)==dist(Bx,By,Cx,Cy)&&(Ay-Cy)*(Ax-Bx)!=(Ay-By)*(Ax-Cx)) {
puts("Yes");
}
else puts("No");
return 0;
}

  

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
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
  input
3
0 0 1 2 0
0 0 9 2 0
0 0 5 9 0
  output
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.

题目大意:一个五维空间,当一个点与其它两个点形成90°时那么这个点是坏的,求有多少坏点。

试题分析:不知道怎么求向量的坐标……

     acos(0)=90,所以说只需要上面那项等于0就统计,暴力好像可以过……

【Codeforces Round】 #432 (Div. 2) 题解的更多相关文章

  1. Codeforces Round #182 (Div. 1)题解【ABCD】

    Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...

  2. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  3. Codeforces Round #525 (Div. 2)题解

    Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...

  4. Codeforces Round #528 (Div. 2)题解

    Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...

  5. Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F

    Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...

  6. Codeforces Round #677 (Div. 3) 题解

    Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...

  7. Codeforces Round #665 (Div. 2) 题解

    Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...

  8. Codeforces Round #160 (Div. 1) 题解【ABCD】

    Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...

  9. Codeforces Round #383 (Div. 2) 题解【ABCDE】

    Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...

  10. Codeforces Round #271 (Div. 2)题解【ABCDEF】

    Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 ...

随机推荐

  1. vue中Prop父子传值方法

    在用vue做项目的过程中感觉很好玩,特做下笔记... 父组件中: <template> <div> <fpdx-modal :zbArr="polygonArr ...

  2. 01_ if 练习

    prompt()        弹出一个对话框,该对话框中会带有一个文本框,用户可以在文本框中输入一段内容. 该函数需要一个字符串作为参数,用作对话框的提示文字. 用户输入内容,将会作为函数返回值.可 ...

  3. java文件与流课后作业

    1,编写一个程序,指定一个文件夹,能自动计算出其总容量, 2,编写一个文件加解密程序,通过命令行完成加解密工作3,编写一个文件分割工具,能把一个大文件分割成多个小的文件.并且能再次把它们合并起来得到完 ...

  4. C语言面试题分类->位运算

    1.不用临时变量交换两个整数. a = a ^ b; b = a ^ b; a = a ^ b; 2.实现一个函数,输入一个整数,输出该数二进制表示中1的个数.例如9的二进制是1001,则输出2. i ...

  5. 20165311《网络对抗技术》Exp1 PC平台逆向破解

    实验要求: 掌握NOP, JNE, JE, JMP, CMP汇编指令的机器码 掌握反汇编与十六进制编程器 能正确修改机器指令改变程序执行流程 能正确构造payload进行bof攻击 实验内容: 手工修 ...

  6. 使用OMS查询Api Management的调用日志

    打开Azure portal,找到要操作的Api Management 实例,点击菜单Monitoring/Logs Schema Tab页搜索"diagnostics",选中Lo ...

  7. ide phpStorm更换主题

    #主题下载地址 http://www.phpstorm-themes.com #更换方式 1.将主题配置保存在 xxx.icls(如果是xml也保存成.icls) 2.打开phpStorm设置(中上方 ...

  8. webapi 利用webapiHelp和swagger生成接口文档

    webapi 利用webapiHelp和swagger生成接口文档.均依赖xml(需允许项目生成注释xml) webapiHelp:微软技术自带,仅含有模块.方法.请求-相应参数的注释. swagge ...

  9. VueJS教程

    文档资料参考: 参考:https://cn.vuejs.org/ 参考:Vue-Cli(客户端) 参考:创建一个Vue项目 参考:https://codesandbox.io 参考:https://c ...

  10. 2019-oo-第二单元总结

    2019-OO-第二单元总结 多线程电梯调度问题 思路综述 第一次作业 第一次作业是非常简单的傻瓜电梯,不需要考虑容量,不需要考虑调度策略,运用了基本的生产者消费者模型,而且生产者消费者模型也一直贯穿 ...