E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
10474
uva
10474
题意:让你找出所要求数字在序列中的位置#include #include #include #include usingnamespacestd; intn,q; inta[10005]; intb[10005]; intmain() { intt=1; while(scanf("%d%d",&n,&q)!=EOF&&n+q) { for(inti=0;i>a[i]; for(inti=0;i>b
u011345136
·
2013-08-04 08:00
10474
- Where is the Marble?
题意:读入一行2个数字N和Q,N表示接下来的N行数字为marbles,Q表示N行数字之后的Q行数字为query.要求把N行marbles从小到大排序,然后输出每个Q在marbles中的位置.思路:把读入的marbles和queries都存放在vector里,然后排序,再逐个查找进行输出即可.要点:使用 sort(marbles.begin(),marbles.end(),less());从小到大进
sailtseng
·
2013-07-23 18:00
where
uva
is
the
10474
Marble?
UVA
10474
题意:找出目标数在所输入数组的位置思路:排序完,在搜索#include #include #include #defineN10050 usingnamespacestd; inta[N],b[N]; intmain(){ intn,m,t=0,flag; while(scanf("%d%d",&n,&m)==2&&(m||n)){ memset(a,0,sizeof(a)); memset(b
u011345461
·
2013-07-20 10:00
uva
10474
Where is the Marble?(计数排序)
WhereistheMarble? RajuandMeenalovetoplaywithMarbles.Theyhavegotalotofmarbleswithnumberswrittenonthem.Atthebeginning,Rajuwouldplacethemarblesoneafteranotherinascendingorderofthenumberswrittenonthem.The
u011328934
·
2013-07-20 00:00
排序/查找
10474
- Where is the Marble?
UVaOJ WhereistheMarble? RajuandMeenalovetoplaywithMarbles.Theyhavegotalotofmarbleswithnumberswrittenonthem.Atthebeginning,Rajuwouldplacethemarblesoneafteranotherinascendingorderofthenumberswrittenonth
SIOFive
·
2013-07-10 09:00
排序
查找
UVa
10474
- Where is the Marble
这题还是从《算法入门经典》上附的。归类居然是回溯!!我就傻傻的按着回溯的思想,或者说第一印象,也就是第一个想到的就是排序后二分查找。结果悲剧TLE然后才想到可是在每次输入的时候就存到个数组里,也就是hash思想吧。#include #include #include usingnamespacestd; longhash[10005]; longans,N,query; intmain() {
xuruoxin
·
2013-04-13 22:00
uva
10474
- Where is the Marble?
/* * uva
10474
.cpp * * Created on:
249326109
·
2013-04-11 15:00
where
UVA
10474
- Where is the Marble?
主要利用题目中的条件,并不需要排序。因为出现的数不超过10000。只需要统计0-10000出现数的个数,就可以确定出现数的排名。#include #include #include intmain(){ intn,q; intque[10005]; intcount=1; while(scanf("%d%d",&n,&q)&&n&&q){ memset(que,0
zcube
·
2013-01-04 17:00
统计
UVaOJ
10474
- Where is the Marble?
AOAPCI: BeginningAlgorithmContests(RujiaLiu) :: Volume1.ElementaryProblemSolving ::Sorting/SearchingDescription找弹珠。每个弹珠都有一个数字(可重复),且按数字大小给弹珠排序。询问一个数字,要求输出该数字在弹珠中出现的最小位置。TypeSorting/SearchingAnalysis给弹
Ra_WinDing
·
2012-11-17 13:00
【索引】Sorting/Searching
RujiaLiu) ::Volume1.ElementaryProblemSolving ::Sorting/Searching340-Master-MindHints10420-ListofConquests
10474
Ra_WinDing
·
2012-11-11 00:00
UVa
10474
Where is the Marble?
题目: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=1415 快排+二分,就是不知道跟回溯法有什么关系。 #include<stdio.h> #include<s
Jianquan
·
2012-08-28 13:00
UVa 10474
UVA
10474
-弹珠在哪里
#include #include usingnamespacestd; intcom(constvoid*a,constvoid*b) { return*(int*)a-*(int*)b; } intmain() { intn,m,num=0; while(cin>>n>>m) { if(!n&&!m)break; num++; cout>a[i]; qsort(a,n,sizeof(a[0])
shankeliupo
·
2012-08-20 22:00
uva
10474
- Where is the Marble?
点击打开链接 代码: //只要对输入的数据排序,然后查找即可(可用二分,更快) #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <list> #include <vector> #includ
isiqi
·
2012-07-15 09:00
where
uva
10474
- Where is the Marble?
点击打开链接代码: //只要对输入的数据排序,然后查找即可(可用二分,更快) #include #include #include #include #include #include #include #include #include usingnamespacestd; constintMAXN=10010; intn,q; intarrN[MAXN]; intarrQ[MAXN]; in
cgl1079743846
·
2012-07-15 09:00
uva-
10474
- Where is the Marble?
今天看我的google阅读器发现怎么我最近更新的博客那么少,以看才知道,原来都在草稿箱里啊::悲剧啊;这是一个很简单的题目,就是输出x在A中排第几小或输出没有x.先输入数x的时候,把a[x]++;那样,输出结束后,a[x]是几,那么就有几个X;#include#includeintmain(){ intm,n,x,i,sum,cas=0; inta[10001],b[10001]; while(s
rowanhaoa
·
2012-06-10 02:00
uva
10474
- Where is the Marble?
WhereistheMarble? RajuandMeenalovetoplaywithMarbles.Theyhavegotalotofmarbleswithnumberswrittenonthem.Atthebeginning,Rajuwouldplacethemarblesoneafteranotherinascendingorderofthenumberswrittenonthem.Th
Frankiller
·
2012-06-09 16:00
10474
- Where is the Marble?
正常的思路,做出来结果超时。 //Time limit exceeded #include <iostream> #include <limits.h> #include <cstdio> using namespace std; #define MAXN 10000 int one[MAXN],two[MAXN],pos_two[MAXN]; int N,
lianxiangbus
·
2012-01-15 23:00
where
10474
- Where is the Marble?(****好题)
正常的思路,做出来结果超时。//Timelimitexceeded #include #include #include usingnamespacestd; #defineMAXN10000 intone[MAXN],two[MAXN],pos_two[MAXN]; intN,Q; intfind(intx) { for(inti=0;itwo[m]&&(two[i]-two[m])=mi
lhshaoren
·
2012-01-15 23:00
uva
10474
Where is the Marble?
题意:给你n个数字,然后查询m个数字在n个数字排序后的位置。#include #include #include #include usingnamespacestd; constintN=10005; inta[N]; intmain() { intn,m,t_cnt=0; while(scanf("%d%d",&n,&m)!=EOF) { if(n==0&&m==0)break; intte
shiqi_614
·
2011-09-20 22:00
ini
10474
--Where is the Marble
///排序后查找#include#include#defineLOCALintnum[10005],test;intn,q,cas=1;intcmp(constvoid*_a,constvoid*_b){int*a=(int*)_a;int*b=(int*)_b;return*a-*b;}voiddecide(){intok=0,i;for(i=0;i#include#defineLOCALint
fengyu0556
·
2010-05-30 14:00
ini
UVa
10474
Where is the Marble?
/*coder:ACboydate:2010-2-25result:1ACdescription:UVa
10474
WhereistheMarble?
ACb0y
·
2010-02-26 00:00
2010
UVa
10474
Where is the Marble?
UVa
10474
WhereistheMarble?我认为刘汝佳在《算法竞赛入门经典》一书中的题目分类有错~这题怎么被归为暴力求解了呢?
心如止水
·
2010-01-09 19:00
上一页
1
2
3
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他