1880. Psych Up's Eigenvalues

Time limit: 0.5 second
Memory limit: 64 MB
At one of the contests at the Petrozavodsk Training Camp, players of
the Psych Up team quickly found the simple problem and Fedya sat at the
computer. The solution was ready in five minutes. Without spending time
for testing, Fedya submitted it and in a few seconds got Time Limit
Exceeded.
Fedya crumpled the problem statement and left the room slamming the
door behind him. Things were going the wrong way and he needed to wind
down. On his way to the restroom Fedya heard a conversation of the contest
authors. Pasha was discussing with his friend the solution of the problem
for which Fedya had got TLE. Fedya could only discern the word
“eigenvalues.”
Fedya thought about it and decided that he, for sure, had his eigenvalues.
For example, the date of birth, the number of his apartment, the mark he
had got at the latest exam, or the number of travels to contests. But they
had a team contest, so what was their team's eigenvalue? Of course, a
number was a team's eigenvalue if it was an eigenvalue for each of its
players. With these joyful thoughts Fedya returned to the contest room.

Input

The input data consist of three blocks two lines each. The first line of
each block contains the number n of a player's eigenvalues (1 ≤ n ≤ 4 000). In the second line you are given n distinct integers in ascending order, which are the eigenvalues. All the eigenvalues are
positive integers not exceeding 109.

Output

Output the number of eigenvalues of the Psych Up team.

Sample

input output
5
13 20 22 43 146
4
13 22 43 146
5
13 43 67 89 146
3
 #include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
int a[],b[],c[];
int main()
{
int t1 = , t2 = , t3 = ;
cin>>t1;
for(int i= ; i < t1; i++)
cin>>a[i];
cin>>t2;
for(int i = ; i < t2; i++)
cin>>b[i];
cin>>t3;
for(int i=;i<t3;i++)
cin>>c[i];
int m=;
int i=,j=,k=;
while(i<t1&&j<t2&&k<t3)
{
int t = min(a[i], min(b[j], c[k]));
if (t == a[i] && t == b[j] && t == c[k])
m++, i++, j++, k++;
else if (t == a[i])
i++;
else if (t == b[j])
j++;
else
k++;
}
printf("%d\n",m);
return ;
}

URAL 1880 Psych Up's Eigenvalues的更多相关文章

  1. OpenCascade Eigenvalues and Eigenvectors of Square Matrix

    OpenCascade Eigenvalues and Eigenvectors of Square Matrix eryar@163.com Abstract. OpenCascade use th ...

  2. A.Kaw矩阵代数初步学习笔记 10. Eigenvalues and Eigenvectors

    “矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...

  3. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  4. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  5. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  6. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  7. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

  8. ural 2068. Game of Nuts

    2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...

  9. ural 2067. Friends and Berries

    2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...

随机推荐

  1. 事件,继承EventArgs带有参数的委托

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. mvc 分部视图(Partial)显示登陆前后变化以及Shared文件夹在解决方案资源管理器中没有显示的问题

    刚开始我的解决方案资源管理器中没有显示Shared文件夹,但Shared文件夹在项目中是实际存在的,我搜了下好像没有类似的解答(可能是我搜索的关键词不够准确).后来自己看了下vs2012. 其实解决方 ...

  3. HDU 6203 2017沈阳网络赛 LCA,DFS+树状数组

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6203 题意:n+1 个点 n 条边的树(点标号 0 ~ n),有若干个点无法通行,导致 p 组 U V ...

  4. Vue起步

    Vue起步 Vue.js是什么 Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式javascript框架.与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用. ...

  5. TF-图像的深度和通道的概念(转)

    图像的深度和通道概念 图像的深度: 图片是由一个个像素点构成的,所有不同颜色的像素点构成了一副完整的图像,计算机存储图片是以二进制来进行的. 1 bit : 用一位来存储,那么这个像素点的取值范围就是 ...

  6. 在虚拟机(vmware)上安装CentOS

    第一步是安装虚拟机,这个比较简单就不讲了. 第二步准备CentOS的镜像文件准备安装 第三步安装CentOS: 新建虚拟机 选择自定义配置 选择硬件兼容标准 选择是否让vmware安装操作系统 选择将 ...

  7. Zookeeper原理架构与搭建

    一.Zookeeper到底是什么!? 学一个东西,不搞明白他是什么东西,哪还有心情学啊!! 首先,Zookeeper是Apache的一个java项目,属于Hadoop系统,扮演管理员的角色. 然后看到 ...

  8. php安装amqp扩展

    1.要安装AMQP PHP扩展,必须先安装librabbitmq库 1.1使用以下步骤下载并安装库: # 下载 git clone git://github.com/alanxz/rabbitmq-c ...

  9. 【AtCoder】ARC097 (C - F)题解

    C - K-th Substring 题解 找出第K大的子串,重复的不计入 这个数据范围可能有什么暴力可以艹过去吧,但是K放大的话这就是后缀自动机板子题啊= = 代码 #include <ios ...

  10. 认识loadrunner及相关性能参数

    认识loadrunner及相关性能参数 LoadRunner,是一种预测系统行为和性能的负载测试工具.通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题,LoadRunner能够对整 ...