hdu5122 K.Bro Sorting
思路:
模拟。
实现:
#include <iostream>
#include <cstdio>
using namespace std; int a[], n, t; int main()
{
int temp;
int j = ;
cin >> t;
while (t--)
{
scanf("%d", &n);
int cnt = ;
for (int i = ; i < n; i++)
{
scanf("%d", &a[i]);
}
int minn = n + ;
for (int i = n - ; i >= ; i--)
{
if (a[i] < minn)
minn = a[i];
else
cnt++;
}
printf("Case #%d: %d\n", ++j, cnt);
}
return ;
}
hdu5122 K.Bro Sorting的更多相关文章
- 树状数组--K.Bro Sorting
题目网址: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=110064#problem/D Description Matt’s frie ...
- HDU 5122 K.Bro Sorting
K.Bro Sorting Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) Tot ...
- K.Bro Sorting
Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submissio ...
- 基础题:HDU 5122 K.Bro Sorting
Matt's friend K.Bro is an ACMer.Yesterday, K.Bro learnt an algorithm: Bubble sort. Bubble sort will ...
- K - K.Bro Sorting
Description Matt’s friend K.Bro is an ACMer. Yesterday, K.Bro learnt an algorithm: Bubble sort. Bubb ...
- HDU 5122 K.Bro Sorting(模拟——思维题详解)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5122 Problem Description Matt's friend K.Bro is an A ...
- hdoj 5122 K.Bro Sorting 贪心
K.Bro Sorting Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) Tot ...
- K.Bro Sorting(思维题)
K.Bro Sorting Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)T ...
- HDU 5122 K.Bro Sorting(2014北京区域赛现场赛K题 模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5122 解题报告:定义一种排序算法,每一轮可以随机找一个数,把这个数与后面的比这个数小的交换,一直往后判 ...
随机推荐
- SpringBoot常用注解总结
在SpringBoot框架中,注解做为一种隐式配置,极大的简化了之前xml文件的配置方式.SpringBoot中包含许多种类的注解,这里对在SpingBoot项目中经常使用到的一些注解的进行大致的归纳 ...
- Ubuntu 16.04安装SoapUI工具进行接口测试(Web Service/WSDL/RESTfull)
SoapUI是一个跨平台接口测试工具,官方提供开源版本和商业版本.可以用来测试WSDL/RESTfull等接口. 替代的工具有JMeter. 一般用于WSDL的接口测试比较多,基于XML的形式,且这类 ...
- 【nginx】nginx与apache的优缺点比较
参考: http://zyan.cc/nginx_php_v6/ nginx相对于apache的优点: 1.轻量级,同样的web 服务,比apache服务器占用更少的内存及资源 2.抗并发,nginx ...
- POJ 1849 Two(遍历树)
POJ 1849 Two(遍历树) http://poj.org/problem?id=1849 题意: 有一颗n个结点的带权的无向树, 在s结点放两个机器人, 这两个机器人会把树的每条边都走一遍, ...
- [React] Make Compound React Components Flexible
Our current compound component implementation is great, but it's limited in that users cannot render ...
- echars入门篇
官网地址:echars. 官方实例:首次使用请点击. 官方文档以及第一次操作实例如下 我们生活中有很多统计图,举例一下,有:柱形图.饼图.折线图等一些可以统计数据的形式. 图有:X轴(横轴),Y轴(纵 ...
- Android如何进行单元测试
Menifest.xml中加入: <application>中加入: <uses-library android:name="android.test.runner&quo ...
- Mac SavePanel 保存文件的GUI代码
// Move the recorded temporary file to a user-specified location (视频文件另存储过程,依据用户选择的路径和文件保存名) NSSaveP ...
- java poi excel导入模板设置下拉框
import org.apache.poi.hssf.usermodel.DVConstraint; import org.apache.poi.hssf.usermodel.HSSFCell; im ...
- 【Codevs 2630】宝库通道
http://codevs.cn/problem/2630/ Solution 预处理f[i][j],代表第j列前i行的代价 枚举上下界,然后做最大子段和,g[i]代表选到第i列的代价, g[k]=( ...