Easy Problem-map和vector的使用】的更多相关文章

Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets easy probl…
Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets easy probl…
11991 - Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests likeXi’an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu’s Presents 1and 2), he occasionally sets easy…
水题 学习一下数据的存储方法. #include<iostream> #include<cstdio> #include<cstdlib> #include<stack> #include<queue> #include<vector> #include<map> using namespace std; int n,m; map<int,vector<int> >a; int main() { w…
UVa11991 Easy Problem from Rujia Liu?  思路:  构造数组data,使满足data[v][k]为第k个v的下标.因为不是每一个整数都会出现因此用到map,又因为每个数出现次数不等可能相差很大,因此用到vector. 注意:对于数据的清空与判空不要忘记,而map在调用之前必须有map.count的检查. 代码: #include<cstdio> #include<map> #include<vector> using namespac…
An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5475 Description One day, a useless calculator was being built by Kuros. Let's assume that number X is showed on the screen of calculator. At first,…
11991 - Easy Problem from Rujia Liu? Time limit: 1.000 seconds Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ con…
option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142" target="_blank" style="">题目链接:uva 11991 - Easy Problem from Rujia Liu? 题目大意:给出一个包括n个整数的数组,你须要回答若干询问,每次询问两个整数k和v,输出从左到右第k个v的下标 解题思路:用map映射一个vector,相应即为m…
Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets easy problem (for example, 'the Coco-Co…
1815: easy problem Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 243  Solved: 108 SubmitStatusWeb Board Description 给你一个数字N,N的范围是1~1000000,求一个最小的正整数M,这个数字M的各个位的数字加上它本身之和恰好为N.当然,如果没有解,输出0. Input 输入数据由多组数据组成,每行由一个数字N组成(1<=N<=1000000). Output 对于每组数据,…
题目意思: http://acm.hdu.edu.cn/showproblem.php? pid=2601 给出一个数N,求N=i*j+i+j一共同拥有多少种方案. 题目分析: 此题直接暴力模拟就可以.仅仅是须要将上式转化为n+1=(i+1)*(j+1)进行计算就可以. AC代码: /** *hdu2601 An easy problem *意思:求n=i*j+i+j的种类 *分析:转化为n+1=(i+1)*(j+1),求解即可了 */ #include<iostream> #include&…
An easy problem Time Limit: 8000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description One day, a useless calculator was being built by Kuros. Let's assume that number X is showed on the screen of calculator. At first…
UVA 11991 - Easy Problem from Rujia Liu? 题目链接 题意:给一个长度n的序列,有m询问,每一个询问会问第k个出现的数字的下标是多少 思路:用map和vector搞,map[i][j]直接保存的就是数字i第j个出现,每次直接输出就可以 代码: #include <cstdio> #include <cstring> #include <vector> #include <map> using namespace std;…
Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets…
An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12970   Accepted: 1995 Description It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his bar…
1041: XX's easy problem Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 41  Solved: 7 [Submit][Status][Web Board] Description XX is a good student who likes to ask questions.But sometimes when you get the problem, you are not willing to answer his qu…
题目链接:POJ 1152 An Easy Problem! 题意:求一个N进制的数R.保证R能被(N-1)整除时最小的N. 第一反应是暴力.N的大小0到62.发现当中将N进制话成10进制时,数据会溢出. 这里有个整除,即(N-1)取模为0. 样例:a1a2a3表示一个N进制的数R.化成10进制: (a1*N*N+a2*N+a3)%(N-1)==((a1*N*N)%(N-1)+(a2*N)%(N-1)+(a3)%(N-1))%(N-1)==(a1+a2+a3)%(N-1). 这样防止了数据的溢出…
题目链接: option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142">https://uva.onlinejudge.org/index.php? option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142 题意: 给一个长度n的序列.有m询问,每一个询问会问第k个出现的数字的下标是多少 用map记录 代码:…
An easy problem Time Limit: 8000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 467    Accepted Submission(s): 258 Problem Description One day, a useless calculator was being built by Kuros. Let's assume that…
地址  Problem - C - Codeforces 题目 题意 一个学校有n个人参加比赛,他们分别属于ui队,每个人的能力值为si 当每个队需要1~n个人的时候,这个学校能参加的人的能力值和最大为多少 解析 map<int,vector<int>>存储不会爆 每一队直接处理出队伍人数为1~n时的能力值最大和,这样不会超时,看代码 代码 #include <iostream> #include <algorithm> #include <vecto…
An easy problem Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of d…
题目传送门 题意:训练指南P187 分析:用vector存id下标,可以用map,也可以离散化用数组存(发现不用离散化也可以) map #include <bits/stdc++.h> using namespace std; map<int, vector<int> >mp; int main(void) { int n, m; while (scanf ("%d%d", &n, &m) == 2) { mp.clear (); f…
An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7837   Accepted: 1145 Description It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his barn…
http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 755 Accepted Submission(s): 431 Problem Description One day, a useless calculator was…
An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1148    Accepted Submission(s): 234 Problem Description Pfctgeorge is totally a tall rich and handsome guy. He plans t…
Problem Description We once did a lot of recursional problem . I think some of them is easy for you and some if hard for you. Now there is a very easy problem . I think you can AC it. We can define sum(n) as follow: if i can be divided exactly by 3 s…
An Easy Problem   Description As we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form. Given a positive integer I, you task is to find out an integer J, which is the m…
</pre><h1 style="color: rgb(26, 92, 200);">An easy problem</h1><strong><span style="color: green; font-family: Arial;">Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot…
问题: 開始尝试用字符做数组元素.可是并没实用. 在推断语句时把a z排出了. An easy problem Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16516    Accepted Submission(s): 11096 Problem Description we define f(A) = 1, f(a) = -1,…
CJOJ 2485 UVa 11991 生日礼物 / UVa 11991 Easy Problem from Rujia Liu? Description (原题来自刘汝佳<训练指南>Page187,UVa 11991.) 可爱的小F就要过生日啦,为了刷存在感,我们的小F十分诚恳(xian de mei shi)地向女神小E要生日礼物.不过傲娇(2333)的小E当然不会随便答应的啦~为了为难小F,小E就说: "如果你能做出这道简单题,我就给你礼物:如果做不出来,嘿嘿嘿嘿-"…