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. HDU 6212 Zuma 2017青岛网络赛 区间DP

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6212 解法:看了眼题就发现这个BZOJ 1032不是一毛一样?但是BZOJ上那是个巨坑,数据有错,原来 ...

  2. 正则表达式基础->

    描述:(grep) 正则表达式是一种字符模式,用于在查找过程中匹配指定的字符.在大多数程序里,正则表达式都被置于两个正斜杠之间,它匹配被查找的行中任何位置出现的相同模式 基础正则表达式 正则表达式 描 ...

  3. Python基础(1):dir(),help()

    Python:3.6.4 开始编写Python程序了...可是,某个模块怎么用呢?模块里的函数怎么用呢?...使用本文介绍的dir().help()两个帮助函数可以 获得绝大部分开发所需要的信息! d ...

  4. matlab设定mex接驳的C/C++编译器

    使用C/C++编写核心算法,使用matlab调用算法.做上层封装,通常是提升效率并提供易用性的一个不错的选择. mex需要设定接驳的C/C++编译器,官方文档在这里:https://ww2.mathw ...

  5. CCF201712真题

    试题编号: 201712-1 试题名称: 最小差值 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 给定n个数,请找出其中相差(差的绝对值)最小的两个数,输出它们的差值的绝对值 ...

  6. hdu 5446(2015长春网络赛J题 Lucas定理+中国剩余定理)

    题意:M=p1*p2*...pk:求C(n,m)%M,pi小于10^5,n,m,M都是小于10^18. pi为质数 M不一定是质数 所以只能用Lucas定理求k次 C(n,m)%Pi最后会得到一个同余 ...

  7. SRILM语言模型格式解读

    先看一下语言模型的输出格式 \data\ ngram = ngram = ngram = \-grams: -5.24036 'cause -0.2084827 -4.675221 'em -0.22 ...

  8. Ionic Js十二:导航ion-nav-view

     ion-nav-view 当用户在你的app中浏览时,ionic能够检测到浏览历史.通过检测浏览历史,实现向左或向右滑动时可以正确转换视图. 采用AngularUI路由器模块等应用程序接口可以分为 ...

  9. ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7

    ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7 在 PHP7 上安装 ECShop V2.7.3时,报错! Deprecated: Methods with the sam ...

  10. Python 多线程 实例

    多线程实例 import threading import time def eat(): eatTime = time.time() for i in range(30): print('count ...