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. 曹冲称象小游戏pygame实现

    #!/usr/bin/env python # -*- coding: UTF-8 -*- import pygame from pygame.locals import * from sys imp ...

  2. Gitlab权限管理

    使用管理员登陆gitlab(版本为8.9)创建一个组 给用户授权 创建新用户 再创建两个dev1和dev2 然后再到项目界面授权给pm授权master 创建库(事先先建一个java组) 设置权限 创建 ...

  3. vue总结 08状态管理vuex

      状态管理 类 Flux 状态管理的官方实现 由于状态零散地分布在许多组件和组件之间的交互中,大型应用复杂度也经常逐渐增长.为了解决这个问题,Vue 提供 vuex:我们有受到 Elm 启发的状态管 ...

  4. 利用CSS函数calc(...)实现Web页面左右布局

    前言 因为自己的网站需要,想要做一个左右布局的页面: 左边是导航菜单之类的东西.右边是文档内容(因为最近看的一些软件的文档页面都是这么布局的): 左边固定宽度——300像素.右边使用剩余的宽度: 左边 ...

  5. Flask:使用jsonify()转换为JSON的数据在Chrome显示为Unicode编码

    Chrome 66,Flask 1.0.2,MongoDB 3.6.3, 创建了一个Flask应用,在将MongoDB中的数据使用PyMongo包获取后,再使用jsonify转换为JSON格式发送回请 ...

  6. python基础-类的其他方法

    一.isinstance(obj,cls)检查是否obj是类的cls对象 # -*- coding:utf-8 -*- __author__ = 'shisanjun' class Foo(objec ...

  7. js面试题之求数组最值

    今天继续分享js常见的面试题,求数组最大值,最小值,这里列举4种常见解法,还有其他方法也可以实现,读者知道可以私信我,我将把意见列举到博客中,欢迎提出意见. 第一种,利用数组排序 var arr=[3 ...

  8. C#实现控制Windows系统关机、重启和注销的方法

    shutdown命令的参数: shutdown.exe -s:关机shutdown.exe -r:关机并重启shutdown.exe -l:注销当前用户 shutdown.exe -s -t 时间:设 ...

  9. 读书笔记--C陷阱与缺陷(七)

    第七章 1.null指针并不指向任何对象,所以只用于赋值和比较运算,其他使用目的都是非法的. 误用null指针的后果是未定义的,根据编译器各异. 有的编译器对内存位置0只读,有的可读写. 书中给出了一 ...

  10. 网络协议之UDP

    前言 TCP协议在不可靠的网络环境上提供了可靠的通信通道,隐藏了大量的底层细节,使应用程序更加简洁.但有些应用并不需要这么高的可靠性,并不需要按序交付,而且TCP为了提高可靠性也增加了延时,在某些对延 ...