ural 1880. Psych Up's Eigenvalues 贪心
来源:互联网 发布:微机原理接口编程题 编辑:程序博客网 时间:2024/06/06 16:38
有3个人
每个人有n个特征值(1 ≤ n ≤ 4 000)
求每个人都有的特征值有几个?(特征值 ≤ 10^9)
Sample
513 20 22 43 146413 22 43 146513 43 67 89 146
3
Problem Author: Denis Mukhametianov
Problem Source: Ural Regional School Programming Contest 2011
Problem Source: Ural Regional School Programming Contest 2011
class InputReader(): def nextInt(self): return int(input().strip()) def nextLine(self): return input() def nextString(self): return input().strip() def nextInts(self): ints = [] str = input().strip().split() for s in str: if (s is None) or (len(s) == 0): continue ints.append(int(s)) return ints def nextFloats(self): floats = [] str = input().strip().split() for s in str: if (s is None) or (len(s) == 0): continue floats.append(float(s)) return floatsif __name__ == '__main__': reader = InputReader() an = reader.nextInt() ; a = reader.nextInts() ; bn = reader.nextInt(); b = reader.nextInts(); cn = reader.nextInt(); c = reader.nextInts(); i = 0 j = 0 k = 0 sum = 0 while i < an and j < bn and k < cn : if a[i] == b[j] and a[i] == c[k]: sum += 1 id = 0 mi = a[i] if mi > b[j]: mi = b[j] id = 1 if mi > c[k]: mi = c[k] id = 2 if id == 0 : i += 1 elif id == 1: j += 1 else: k += 1 print(sum)
阅读全文
0 0
- ural 1880. Psych Up's Eigenvalues 贪心
- ural 1880. Psych Up's Eigenvalues
- Ural 1880. Psych Up's Eigenvalues
- URAL 1880. Psych Up's Eigenvalues
- Timus 1880. Psych Up's Eigenvalues题解
- URAL 1880Psych Up's Eigenvalues multiset水题
- URAL 1880 Psych Up's Eigenvalues (技巧)
- URAL 1876. Centipede's Morning (贪心)
- ural 1820. Ural Steaks 贪心
- URAL 1389 Roadworks 贪心
- URAL 1826. Minefield 贪心
- Ural 2041 Nanomatryoshkas(贪心)
- URAL 1820 Ural Steaks (贪心)
- Ivan's Car URAL
- missing psych
- ural 1303 Minimal Coverage【贪心】
- URAL 1901 Space Elevators(贪心)
- URAL 1303. Minimal Coverage 贪心
- sql统计分组的组数
- 238. Product of Array Except Self
- php在linux上解析word文档
- maven全局配置文件settings.xml详解
- constexpr说明以及g++4.8.2实测分析
- ural 1880. Psych Up's Eigenvalues 贪心
- Socket PRGM: chat_p2p
- 错误LinearLayoutManager is already attached to a RecyclerView
- 在broadcastReceiver 中弹出对话框
- oracle10G/11G官方下载地址集合 直接迅雷下载
- adaBoost算法学习笔记
- 文章标题
- SpringMVC学习之非注解的处理器映射器和适配器
- 14. Longest Common Prefix